|
| 1 | +<?php |
| 2 | +declare( strict_types = 1 ); |
| 3 | + |
| 4 | +namespace TheWebSolver\Codegarage\Generator\Enum; |
| 5 | + |
| 6 | +enum Argument: string { |
| 7 | + case Name = 'name'; |
| 8 | + case Type = 'type'; |
| 9 | + case Default = 'defaultValue'; |
| 10 | + case Position = 'position'; |
| 11 | + case Promoted = 'isPromoted'; |
| 12 | + case Variadic = 'isVariadic'; |
| 13 | + case Nullable = 'isNullable'; |
| 14 | + case Reference = 'isReference'; |
| 15 | + |
| 16 | + /** @var array{type:self,defaultValue:self,isPromoted:self,isVariadic:self,isNullable:self,isReference:self} */ |
| 17 | + public const INTRACTABLE = array( |
| 18 | + Argument::Type->value => Argument::Type, |
| 19 | + Argument::Default->value => Argument::Default, |
| 20 | + Argument::Promoted->value => Argument::Promoted, |
| 21 | + Argument::Variadic->value => Argument::Variadic, |
| 22 | + Argument::Nullable->value => Argument::Nullable, |
| 23 | + Argument::Reference->value => Argument::Reference, |
| 24 | + ); |
| 25 | + |
| 26 | + /** @var array{name:self,position:self} */ |
| 27 | + public const NON_INTRACTABLE = array( |
| 28 | + self::Name->value => self::Name, |
| 29 | + self::Position->value => self::Position, |
| 30 | + ); |
| 31 | + |
| 32 | + public function isIntractable(): bool { |
| 33 | + return ! isset( self::NON_INTRACTABLE[ $this->value ] ); |
| 34 | + } |
| 35 | +} |
0 commit comments