Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
25 | 12 | public static function unflatten(array $array): array |
|
26 | { |
||
27 | 12 | $output = []; |
|
28 | 12 | foreach ($array as $key => $value) { |
|
29 | 12 | static::set($output, $key, $value); |
|
|
|||
30 | 12 | if (is_array($value) && strpos($key, '.') === false) { |
|
31 | 12 | $output[$key] = static::unflatten($value); |
|
32 | } |
||
33 | } |
||
34 | 12 | return $output; |
|
35 | } |
||
36 | |||
54 | } |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: