Conditions | 7 |
Paths | 1 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __invoke() { |
||
17 | return function (): Collection { |
||
18 | if ($this->isEmpty()) { |
||
|
|||
19 | return new static(); |
||
20 | } |
||
21 | |||
22 | $firstItem = $this->first(); |
||
23 | |||
24 | $expectedLength = is_array($firstItem) || $firstItem instanceof Countable ? count($firstItem) : 0; |
||
25 | |||
26 | array_walk($this->items, function ($row) use ($expectedLength) { |
||
27 | if ((is_array($row) || $row instanceof Countable) && count($row) !== $expectedLength) { |
||
28 | throw new \LengthException("Element's length must be equal."); |
||
29 | } |
||
30 | }); |
||
31 | |||
32 | $items = array_map(function (...$items) { |
||
33 | return new static($items); |
||
34 | }, ...array_map(function ($items) { |
||
35 | return $this->getArrayableItems($items); |
||
36 | }, array_values($this->items))); |
||
37 | |||
38 | return new static($items); |
||
39 | }; |
||
40 | } |
||
41 | } |
||
42 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.