1 | <?php |
||
22 | class Type implements TypeInterface |
||
23 | { |
||
24 | use Serializable; |
||
25 | |||
26 | /** |
||
27 | * @var Type[] |
||
28 | */ |
||
29 | private static $instances = []; |
||
30 | |||
31 | /** |
||
32 | * @var array[]|string[][] |
||
33 | */ |
||
34 | private static $inheritance = []; |
||
35 | |||
36 | /** |
||
37 | * @var array|string[] |
||
38 | */ |
||
39 | private $parent; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $name; |
||
45 | |||
46 | /** |
||
47 | * BaseType constructor. |
||
48 | * @param string $name |
||
49 | */ |
||
50 | 1 | private function __construct(string $name) |
|
55 | |||
56 | /** |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function isInputable(): bool |
||
63 | |||
64 | /** |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function isReturnable(): bool |
||
71 | |||
72 | /** |
||
73 | * @param string $name |
||
74 | * @return array |
||
75 | */ |
||
76 | 1 | private function getInheritanceSequence(string $name): array |
|
84 | |||
85 | /** |
||
86 | * @param \SplStack $stack |
||
87 | * @param array $children |
||
88 | */ |
||
89 | private function bootInheritance(\SplStack $stack, array $children = []): void |
||
113 | |||
114 | /** |
||
115 | * @param string|ProvidesType $type |
||
116 | * @return Type|\Railt\Reflection\Contracts\Type |
||
117 | */ |
||
118 | 98 | public static function of($type): Type |
|
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isDependent(): bool |
||
138 | |||
139 | /** |
||
140 | * @param TypeInterface $type |
||
141 | * @return bool |
||
142 | */ |
||
143 | 90 | public function instanceOf(TypeInterface $type): bool |
|
149 | |||
150 | /** |
||
151 | * @param string $type |
||
152 | * @return bool |
||
153 | */ |
||
154 | 98 | public function is(string $type): bool |
|
158 | |||
159 | /** |
||
160 | * @return string |
||
161 | */ |
||
162 | 98 | public function getName(): string |
|
166 | |||
167 | /** |
||
168 | * @return string |
||
169 | */ |
||
170 | 90 | public function __toString(): string |
|
174 | } |
||
175 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.