1 | <?php |
||
15 | trait TransmapHydratable |
||
16 | { |
||
17 | private static $transmapper; |
||
18 | |||
19 | private static function getTransmapper(): Transmapper |
||
30 | |||
31 | /** |
||
32 | * @param array $objectArray |
||
33 | * @return array |
||
34 | */ |
||
35 | protected static function hydratePreprocess(array $objectArray): array |
||
39 | |||
40 | /** |
||
41 | * @param array $objectArray |
||
42 | * |
||
43 | * @return static |
||
44 | * @throws \Audiens\DoubleclickClient\exceptions\ClientException |
||
45 | */ |
||
46 | public static function fromArray(array $objectArray) |
||
55 | |||
56 | /** |
||
57 | * @return array |
||
58 | * @throws \RuntimeException |
||
59 | */ |
||
60 | public function toArray() |
||
64 | } |
||
65 |
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: