1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Part of SplTypes package. |
||
5 | * |
||
6 | * (c) Adrien Loyant <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | declare(strict_types=1); |
||
13 | |||
14 | namespace Ducks\Component\SplTypes; |
||
15 | |||
16 | /** |
||
17 | * SplEnumBacked gives the ability to emulate and create backed enumeration objects natively in PHP. |
||
18 | * |
||
19 | * @property mixed $value |
||
20 | * |
||
21 | * @template T |
||
22 | * @extends SplEnumUnit<T> |
||
23 | * @implements SplBackedEnum<T> |
||
24 | * |
||
25 | * @psalm-api |
||
26 | */ |
||
27 | #[\AllowDynamicProperties] |
||
28 | abstract class SplEnumBacked extends SplEnumUnit implements SplBackedEnum |
||
29 | { |
||
30 | /** @use SplBackedEnumTrait<T> */ |
||
31 | use SplBackedEnumTrait; |
||
32 | /** @use SplEnumBackedTrait<T> */ |
||
33 | use SplEnumBackedTrait; |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | * |
||
38 | * @psalm-suppress UnsupportedPropertyReferenceUsage |
||
39 | */ |
||
40 | protected function __construct() |
||
41 | { |
||
42 | // Value can be undeclare because typed definition can change. |
||
43 | $this->value = &$this->__default; |
||
44 | } |
||
45 | } |
||
46 |