| 1 | <?php |
||
| 10 | class Type |
||
| 11 | { |
||
| 12 | public const TYPE_BOOL = 'bool'; |
||
| 13 | public const TYPE_INT = 'int'; |
||
| 14 | public const TYPE_FLOAT = 'float'; |
||
| 15 | public const TYPE_STRING = 'string'; |
||
| 16 | public const TYPE_ARRAY = 'array'; |
||
| 17 | public const TYPE_CALLABLE = 'callable'; |
||
| 18 | public const TYPE_MIXED = 'mixed'; |
||
| 19 | public const TYPE_VOID = 'void'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $type; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var bool |
||
| 28 | */ |
||
| 29 | protected $isNullable; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $type |
||
| 33 | * @param bool $isNullable |
||
| 34 | */ |
||
| 35 | 2 | public function __construct(string $type, bool $isNullable = false) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 2 | public function type(): string |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | 2 | public function isNullable(): bool |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return bool |
||
| 59 | */ |
||
| 60 | 2 | public function isScalar(): bool |
|
| 74 | } |
||
| 75 |