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