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