| 1 | <?php |
||
| 14 | trait TransmapHydratable |
||
| 15 | { |
||
| 16 | private static $transmapper; |
||
| 17 | |||
| 18 | private static function getTransmapper(): Transmapper |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param array $objectArray |
||
| 29 | * @return array |
||
| 30 | */ |
||
| 31 | protected static function hydratePreprocess(array $objectArray): array |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param array $objectArray |
||
| 38 | * |
||
| 39 | * @return static |
||
| 40 | * @throws \Audiens\DoubleclickClient\exceptions\ClientException |
||
| 41 | */ |
||
| 42 | public static function fromArray(array $objectArray) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return array |
||
| 55 | * @throws \RuntimeException |
||
| 56 | */ |
||
| 57 | public function toArray() |
||
| 61 | } |
||
| 62 |
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
SomeClassto useselfinstead: