| Conditions | 7 | 
| Paths | 1 | 
| Total Lines | 28 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php namespace Spatie\CollectionMacros\Macros;  | 
            ||
| 16 | public function validate()  | 
            ||
| 17 |     { | 
            ||
| 18 |         return function ($callback): bool { | 
            ||
| 19 |             if (is_string($callback) || is_array($callback)) { | 
            ||
| 20 | $validationRule = $callback;  | 
            ||
| 21 | |||
| 22 |                 $callback = function ($item) use ($validationRule) { | 
            ||
| 23 |                     if (! is_array($item)) { | 
            ||
| 24 | $item = ['default' => $item];  | 
            ||
| 25 | }  | 
            ||
| 26 | |||
| 27 |                     if (! is_array($validationRule)) { | 
            ||
| 28 | $validationRule = ['default' => $validationRule];  | 
            ||
| 29 | }  | 
            ||
| 30 | |||
| 31 |                     return app('validator')->make($item, $validationRule)->passes(); | 
            ||
| 32 | };  | 
            ||
| 33 | }  | 
            ||
| 34 | |||
| 35 |             foreach ($this->items as $item) { | 
            ||
| 36 |                 if (! $callback($item)) { | 
            ||
| 37 | return false;  | 
            ||
| 38 | }  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | return true;  | 
            ||
| 42 | };  | 
            ||
| 43 | }  | 
            ||
| 44 | }  | 
            ||
| 45 | 
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.