1 | <?php |
||
13 | final class AnnotationType |
||
14 | { |
||
15 | /** |
||
16 | * @var Type |
||
17 | */ |
||
18 | private $type; |
||
19 | /** |
||
20 | * @var AnnotationType|null |
||
21 | */ |
||
22 | private $next; |
||
23 | |||
24 | /** |
||
25 | * AnnotationType constructor. |
||
26 | * |
||
27 | * @param string $type |
||
28 | * @param AnnotationType|null $next |
||
|
|||
29 | * |
||
30 | * @throws Exception |
||
31 | */ |
||
32 | private function __construct(string $type, self $next = null) |
||
37 | |||
38 | /** |
||
39 | * @param string $type |
||
40 | * |
||
41 | * @return AnnotationType |
||
42 | * @throws Exception |
||
43 | */ |
||
44 | public static function parse(string $type): self |
||
58 | |||
59 | /** |
||
60 | * @return Type |
||
61 | */ |
||
62 | public function getType(): Type |
||
66 | |||
67 | /** |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function hasNext(): bool |
||
74 | |||
75 | /** |
||
76 | * @return AnnotationType|null |
||
77 | */ |
||
78 | public function next(): ?self |
||
82 | |||
83 | /** |
||
84 | * @param mixed $expression |
||
85 | * |
||
86 | * @return bool |
||
87 | * @throws Exception |
||
88 | */ |
||
89 | public function isImplicit($expression): bool |
||
100 | |||
101 | /** |
||
102 | * @param mixed $expression |
||
103 | * |
||
104 | * @return bool |
||
105 | * @throws Exception |
||
106 | */ |
||
107 | public function isSame($expression): bool |
||
118 | |||
119 | /** |
||
120 | * @param array $expression |
||
121 | * @param callable $callback |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | private function compare(array $expression, callable $callback): bool |
||
135 | |||
136 | /** |
||
137 | * @return int |
||
138 | */ |
||
139 | public function getDimension(): int |
||
145 | |||
146 | /** |
||
147 | * @return Type|null |
||
148 | */ |
||
149 | public function getBaseType(): ?Type |
||
155 | |||
156 | /** |
||
157 | * @param int|null $dimension |
||
158 | * |
||
159 | * @return AnnotationType|null |
||
160 | */ |
||
161 | private function iterate(int &$dimension = null): ?self |
||
172 | |||
173 | /** |
||
174 | * @return string|null |
||
175 | */ |
||
176 | public function export(): ?string |
||
182 | } |
||
183 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.