1 | <?php |
||
6 | class ArrHelper |
||
7 | { |
||
8 | /** |
||
9 | * @param array $array |
||
10 | * @return bool |
||
11 | */ |
||
12 | public static function isStrKeysArray(array $array): bool |
||
20 | |||
21 | /** |
||
22 | * @param array $array |
||
23 | * @return array |
||
24 | */ |
||
25 | 12 | public static function unflatten(array $array): array |
|
36 | |||
37 | /** |
||
38 | * @param array $array |
||
39 | * @param string $key |
||
40 | * @param mixed $value |
||
41 | */ |
||
42 | 12 | private static function set(array &$array, string $key, $value) |
|
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: