Skip to content

Commit

Permalink
Phpdoc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 15, 2024
1 parent 27fd05e commit 5d301bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Interfaces/ArrayViewInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @template T The type of elements in the array
*
* @extends \ArrayAccess<int|string|array<mixed>|ArrayViewInterface<mixed>|ArraySelectorInterface, T|array<T>>
* @extends \ArrayAccess<int|string|array<int|bool>|ArrayViewInterface<int|bool>|ArraySelectorInterface, T|array<T>>
* @extends \IteratorAggregate<int, T>
*/
interface ArrayViewInterface extends \ArrayAccess, \IteratorAggregate, \Countable
Expand Down Expand Up @@ -86,8 +86,8 @@ public function is(callable $predicate): MaskSelectorInterface;
/**
* Returns a subview of this view based on a selector or string slice.
*
* @param string|array<mixed>|ArrayViewInterface<mixed>|ArraySelectorInterface $selector The selector or string
* to filter the subview.
* @param string|array<int|bool>|ArrayViewInterface<int|bool>|ArraySelectorInterface $selector The selector or
* string to filter the subview.
* @param bool|null $readonly Flag indicating if the subview should be read-only.
*
* @return ArrayViewInterface<T> A new view representing the subview of this view.
Expand Down
4 changes: 3 additions & 1 deletion src/Traits/ArrayViewAccessTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* and unsetting elements in the ArrayView object.
*
* @template T Type of ArrayView values.
* @template S of string|array<mixed>|ArrayViewInterface<mixed>|ArraySelectorInterface Type of selectors.
* @template S of string|array<int|bool>|ArrayViewInterface<int|bool>|ArraySelectorInterface Selector type.
*/
trait ArrayViewAccessTrait
{
Expand Down Expand Up @@ -149,9 +149,11 @@ protected function toSelector($input): ArraySelectorInterface
}

if (\count($input) > 0 && \is_bool($input[0])) {
/** @var array<bool> $input */
return new MaskSelector($input);
}

/** @var array<int> $input */
return new IndexListSelector($input);
}
}
4 changes: 2 additions & 2 deletions src/Views/ArrayView.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class ArrayView implements ArrayViewInterface
{
/**
* @use ArrayViewAccessTrait<T, string|array<mixed>|ArrayViewInterface<mixed>|ArraySelectorInterface>
* @use ArrayViewAccessTrait<T, string|array<int|bool>|ArrayViewInterface<int|bool>|ArraySelectorInterface>
*
* for array access methods.
*/
Expand Down Expand Up @@ -274,7 +274,7 @@ public function is(callable $predicate): MaskSelectorInterface
* $subview[0] = [11]; // throws ReadonlyError
* ```
*
* @template S of string|array<mixed>|ArrayViewInterface<mixed>|ArraySelectorInterface
* @template S of string|array<int|bool>|ArrayViewInterface<int|bool>|ArraySelectorInterface Selector type.
*
* @param S $selector The selector or string to filter the subview.
* @param bool|null $readonly Flag indicating if the subview should be read-only.
Expand Down

0 comments on commit 5d301bd

Please sign in to comment.