Skip to content

Commit cbe3a20

Browse files
authored
Merge pull request #3 from mwijngaard/master
Expand/fix a lot of type hints
2 parents d58c775 + 238bd83 commit cbe3a20

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/IterableObject.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
final class IterableObject implements IteratorAggregate
1212
{
1313
/**
14-
* @var array|Traversable
14+
* @var iterable|array|Traversable
1515
*/
1616
private $iterable;
1717

@@ -27,9 +27,9 @@ final class IterableObject implements IteratorAggregate
2727

2828
/**
2929
* IterableObject constructor.
30-
* @param $iterable
31-
* @param callable|null $filter
32-
* @param callable|null $map
30+
* @param iterable|array|Traversable $iterable
31+
* @param callable|null $filter
32+
* @param callable|null $map
3333
* @throws InvalidArgumentException
3434
*/
3535
public function __construct($iterable, $filter = null, $map = null)

src/iterable-functions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Check wether or not a variable is iterable (i.e array or \Traversable)
1515
*
16-
* @param array|\Traversable $iterable
16+
* @param mixed $iterable
1717
* @return bool
1818
*/
1919
function is_iterable($iterable)
@@ -27,8 +27,8 @@ function is_iterable($iterable)
2727
/**
2828
* Copy the iterable into an array. If the iterable is already an array, return it.
2929
*
30-
* @param iterable $iterable
31-
* @param bool $use_keys [optional] Whether to use the iterator element keys as index.
30+
* @param iterable|array|\Traversable $iterable
31+
* @param bool $use_keys [optional] Whether to use the iterator element keys as index.
3232
* @return array
3333
*/
3434
function iterable_to_array($iterable, $use_keys = true)
@@ -42,7 +42,7 @@ function iterable_to_array($iterable, $use_keys = true)
4242
/**
4343
* If the iterable is not intance of \Traversable, it is an array => convert it to an ArrayIterator.
4444
*
45-
* @param $iterable
45+
* @param iterable|array|\Traversable $iterable
4646
* @return \Traversable
4747
*/
4848
function iterable_to_traversable($iterable)
@@ -67,8 +67,8 @@ function iterable_to_traversable($iterable)
6767
/**
6868
* Filters an iterable.
6969
*
70-
* @param $iterable
71-
* @param callable $filter
70+
* @param iterable|array|\Traversable $iterable
71+
* @param callable $filter
7272
* @return array|CallbackFilterIterator
7373
* @throws InvalidArgumentException
7474
*/
@@ -106,9 +106,9 @@ function iterable_filter($iterable, $filter = null)
106106
}
107107

108108
/**
109-
* @param $iterable
110-
* @param callable|null $filter
111-
* @param callable|null $map
109+
* @param iterable|array|\Traversable $iterable
110+
* @param callable|null $filter
111+
* @param callable|null $map
112112
* @return Traversable|IterableObject
113113
* @throws InvalidArgumentException
114114
*/

src/iterable-map-php53.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/**
66
* Maps a callable to an iterable.
77
*
8-
* @param $iterable
9-
* @param callable $map
8+
* @param iterable|array|\Traversable $iterable
9+
* @param callable $map
1010
* @return array|ArrayIterator
1111
* @throws InvalidArgumentException
1212
*/

src/iterable-map-php55.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/**
66
* Maps a callable to an iterable.
77
*
8-
* @param $iterable
9-
* @param callable $map
8+
* @param iterable|array|\Traversable $iterable
9+
* @param callable $map
1010
* @return array|Traversable
1111
* @throws InvalidArgumentException
1212
*/

0 commit comments

Comments
 (0)