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