Conditions | 3 |
Paths | 1 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Spatie\CollectionMacros\Macros; |
||
16 | public function after() |
||
17 | { |
||
18 | return function ($currentItem, $fallback = null) { |
||
19 | $currentKey = $this->search($currentItem, true); |
||
20 | |||
21 | if ($currentKey === false) { |
||
22 | return $fallback; |
||
23 | } |
||
24 | |||
25 | $currentOffset = $this->keys()->search($currentKey, true); |
||
26 | |||
27 | $next = $this->slice($currentOffset, 2); |
||
28 | |||
29 | if ($next->count() < 2) { |
||
30 | return $fallback; |
||
31 | } |
||
32 | |||
33 | return $next->last(); |
||
34 | }; |
||
35 | } |
||
36 | } |
||
37 |
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
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.