1 | <?php |
||
19 | class TransformerHelper |
||
20 | { |
||
21 | /** |
||
22 | * @param $transformer |
||
23 | * @return bool |
||
24 | */ |
||
25 | 3 | public static function isTransformer($transformer): bool |
|
30 | |||
31 | /** |
||
32 | * @param $transformer |
||
33 | * @return bool |
||
34 | */ |
||
35 | public static function isTransformerClass($transformer): bool |
||
39 | |||
40 | /** |
||
41 | * @param $transformer |
||
42 | * @return null|callable|TransformerInterface |
||
43 | */ |
||
44 | public static function resolve($transformer) |
||
56 | |||
57 | /** |
||
58 | * @param TransformerInterface $transformer |
||
59 | * @return array |
||
60 | */ |
||
61 | public static function normalizeIncludes(TransformerInterface $transformer): array |
||
65 | |||
66 | /** |
||
67 | * @param TransformerInterface $transformer |
||
68 | * @param string $key |
||
69 | * @return bool |
||
70 | */ |
||
71 | public static function inInclude(TransformerInterface $transformer, string $key): bool |
||
75 | |||
76 | /** |
||
77 | * @param array $includes |
||
78 | * @return array |
||
79 | */ |
||
80 | private static function normalizeIncludesInternal(array $includes) |
||
112 | |||
113 | /** |
||
114 | * Retrieves the value of an array element or object property with the given key or property name. |
||
115 | * |
||
116 | * @param $array |
||
117 | * @param $key |
||
118 | * @param null $default |
||
119 | * @return mixed|null |
||
120 | */ |
||
121 | private static function findInArray(array $array, string $key, $default = null) |
||
130 | } |
||
131 |
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: