Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public static function redisListToArray(array $list) |
||
15 | { |
||
16 | // Redis lists come into a format where the keys are on even indexes |
||
17 | // and the values are on odd indexes. This way, we know which |
||
18 | // ones are keys and which ones are values and their get combined |
||
19 | // later to form the key => value array. |
||
20 | [$keys, $values] = collect($list)->partition(function ($value, $key) { |
||
21 | return $key % 2 === 0; |
||
22 | }); |
||
23 | |||
24 | return array_combine($keys->all(), $values->all()); |
||
25 | } |
||
26 | } |
||
27 |
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.