Conditions | 7 |
Paths | 1 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function __invoke() |
||
18 | { |
||
19 | return function ($callback): bool { |
||
20 | if (is_string($callback) || is_array($callback)) { |
||
21 | $validationRule = $callback; |
||
22 | |||
23 | $callback = function ($item) use ($validationRule) { |
||
24 | if (! is_array($item)) { |
||
25 | $item = ['default' => $item]; |
||
26 | } |
||
27 | |||
28 | if (! is_array($validationRule)) { |
||
29 | $validationRule = ['default' => $validationRule]; |
||
|
|||
30 | } |
||
31 | |||
32 | return app('validator')->make($item, $validationRule)->passes(); |
||
33 | }; |
||
34 | } |
||
35 | |||
36 | foreach ($this->items as $item) { |
||
37 | if (! $callback($item)) { |
||
38 | return false; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return true; |
||
43 | }; |
||
44 | } |
||
45 | } |
||
46 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope