1 | <?php |
||
24 | abstract class Enum extends BaseEnum implements EquatableInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected static $defaultCache = array(); |
||
30 | |||
31 | /** |
||
32 | * @param mixed $value |
||
33 | * |
||
34 | * @return bool |
||
35 | */ |
||
36 | public function is($value) |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function equals($other) |
||
48 | |||
49 | /** |
||
50 | * @param string $name |
||
51 | * @param array $arguments |
||
52 | * |
||
53 | * @return static |
||
54 | * |
||
55 | * @throws \BadMethodCallException |
||
56 | */ |
||
57 | public static function __callStatic($name, $arguments) |
||
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | public static function toArray() |
||
85 | |||
86 | /** |
||
87 | * @return array |
||
88 | */ |
||
89 | private static function constants() |
||
102 | } |
||
103 |
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: