1 | <?php |
||
4 | class Collection implements \IteratorAggregate |
||
5 | { |
||
6 | use Traits\SortTrait; |
||
7 | use Traits\SetsTrait; |
||
8 | use Traits\TerminateTrait; |
||
9 | use Traits\LimitTrait; |
||
10 | use Traits\TransformTrait; |
||
11 | |||
12 | const TYPE_FOR = 'for'; |
||
13 | const TYPE_FOREACH = 'foreach'; |
||
14 | |||
15 | private $type = self::TYPE_FOREACH; |
||
16 | private $debug = false; |
||
17 | |||
18 | private $ops = []; |
||
19 | private $seed; |
||
20 | private $is_array; |
||
21 | private $vars = []; |
||
22 | private $fn_cnt = 0; |
||
23 | |||
24 | /** |
||
25 | * @return \Spindle\Collection |
||
26 | */ |
||
27 | 10 | public static function from($iterable, $debug = null) |
|
31 | |||
32 | /** |
||
33 | * Generator-based range() |
||
34 | * @param int|string $start |
||
35 | * @param int|string $end |
||
36 | * @param int $step |
||
37 | * @param bool $debug |
||
38 | * @return \Spindle\Collection |
||
39 | */ |
||
40 | 23 | public static function range($start, $end, $step = 1, $debug = null) |
|
60 | |||
61 | /** |
||
62 | * Generator-based repeat() |
||
63 | * @param mixed $elem |
||
64 | * @param int $count |
||
65 | * @param bool $debug |
||
66 | */ |
||
67 | 2 | public static function repeat($elem, $count, $debug = null) |
|
81 | |||
82 | /** |
||
83 | * @param iterable $seed |
||
84 | */ |
||
85 | 32 | public function __construct($seed, $debug = null, $type = null) |
|
101 | |||
102 | 17 | private function step() |
|
110 | |||
111 | /** |
||
112 | * @return \Generator|\ArrayIterator |
||
113 | */ |
||
114 | 1 | public function getIterator() |
|
130 | |||
131 | /** |
||
132 | * @return array |
||
133 | */ |
||
134 | 19 | public function toArray() |
|
156 | |||
157 | /** |
||
158 | * @return $this |
||
159 | */ |
||
160 | 1 | public function dump() |
|
165 | |||
166 | /** |
||
167 | * @return $this |
||
168 | */ |
||
169 | 1 | public function assignTo(&$var = null) |
|
174 | |||
175 | /** |
||
176 | * @return $this |
||
177 | */ |
||
178 | 4 | public function assignArrayTo(&$var = null) |
|
183 | |||
184 | /** |
||
185 | * @return string |
||
186 | */ |
||
187 | 1 | public function __toString() |
|
195 | |||
196 | /** |
||
197 | * @return array |
||
198 | */ |
||
199 | 1 | public function __debugInfo() |
|
217 | |||
218 | private static function evaluate($_seed, $_vars, $_code, $_before, $_after) |
||
234 | |||
235 | 25 | private function compile($ops) |
|
243 | |||
244 | 20 | private static function compileFor($ops, $seed) |
|
258 | |||
259 | 10 | private static function compileForeach($ops) |
|
271 | } |
||
272 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: