Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class TypeDeclaration |
||
11 | { |
||
12 | /** @var string[] All valid types for PHP 7.1 */ |
||
13 | private static $builtInTypes = [ |
||
14 | 'int', 'bool', 'string', 'array', 'float', 'callable', 'iterable' |
||
15 | ]; |
||
16 | |||
17 | /** @var string */ |
||
18 | private $name; |
||
19 | |||
20 | public function __construct(?string $name) |
||
21 | { |
||
22 | $this->name = $name; |
||
23 | } |
||
24 | |||
25 | public function isPresent(): bool |
||
26 | { |
||
27 | return $this->name !== null; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * This will help when building the relationships between classes/interfaces since built-in |
||
32 | * types are not part of a UML class diagram |
||
33 | */ |
||
34 | public function isBuiltIn(): bool |
||
37 | } |
||
38 | |||
39 | public function __toString() |
||
42 | } |
||
43 | } |
||
44 |