These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Illuminate\Support\Collection; |
||
4 | |||
5 | /* |
||
6 | * Check whether a collection doesn't contain any occurrences of a given |
||
7 | * item, key-value pair, or passing truth test. `none` accepts the same |
||
8 | * parameters as the `contains` collection method. |
||
9 | * |
||
10 | * @see \Illuminate\Support\Collection::contains |
||
11 | * |
||
12 | * @param mixed $key |
||
13 | * @param mixed $value |
||
14 | * |
||
15 | * @return bool |
||
16 | */ |
||
17 | Collection::macro('none', function ($key, $value = null): bool { |
||
18 | if (func_num_args() === 2) { |
||
19 | return ! $this->contains($key, $value); |
||
0 ignored issues
–
show
|
|||
20 | } |
||
21 | |||
22 | return ! $this->contains($key); |
||
23 | }); |
||
24 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.