Total Complexity | 3 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | #[\AllowDynamicProperties] |
||
22 | abstract class SplEnumBacked extends SplEnumUnit implements SplBackedEnum |
||
23 | { |
||
24 | use SplBackedEnumTrait; |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | protected function __construct() |
||
30 | { |
||
31 | // Value can be undeclare because typed definition can change. |
||
32 | $this->value = &$this->__default; |
||
|
|||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Instanciate an exported object. |
||
37 | * |
||
38 | * @param array<mixed,mixed> $properties |
||
39 | * |
||
40 | * @return SplBackedEnum |
||
41 | * |
||
42 | * @codeCoverageIgnore |
||
43 | * @psalm-suppress UnsafeInstantiation |
||
44 | */ |
||
45 | #[\ReturnTypeWillChange] |
||
46 | public static function __set_state(array $properties): SplBackedEnum |
||
47 | { |
||
48 | /** @var SplEnumBacked $object */ |
||
49 | $object = parent::__set_state($properties); |
||
50 | $object->value = $properties['value']; |
||
51 | |||
52 | return $object; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Dumping object. |
||
57 | * |
||
58 | * @return array<string,string> |
||
59 | * |
||
60 | * @codeCoverageIgnore |
||
61 | */ |
||
62 | public function __debugInfo(): array |
||
67 | ]; |
||
68 | } |
||
69 | } |
||
70 |