| Conditions | 5 |
| Paths | 1 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function sectionBy() |
||
| 20 | { |
||
| 21 | return function ($key, bool $preserveKeys = false, $sectionKey = 0, $itemsKey = 1): Collection { |
||
| 22 | $sectionNameRetriever = $this->valueRetriever($key); |
||
| 23 | |||
| 24 | $results = new Collection(); |
||
| 25 | |||
| 26 | foreach ($this->items as $key => $value) { |
||
| 27 | $sectionName = $sectionNameRetriever($value); |
||
| 28 | |||
| 29 | if (! $results->last() || $results->last()->get($sectionKey) !== $sectionName) { |
||
| 30 | $results->push(new Collection([ |
||
| 31 | $sectionKey => $sectionName, |
||
| 32 | $itemsKey => new Collection(), |
||
| 33 | ])); |
||
| 34 | } |
||
| 35 | |||
| 36 | $results->last()->get($itemsKey)->offsetSet($preserveKeys ? $key : null, $value); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $results; |
||
| 40 | }; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.