1 | <?php |
||
12 | final class AnnotationType |
||
13 | { |
||
14 | /** |
||
15 | * @var Type |
||
16 | */ |
||
17 | private $type; |
||
18 | /** |
||
19 | * @var AnnotationType |
||
20 | */ |
||
21 | private $next; |
||
22 | |||
23 | /** |
||
24 | * AnnotationType constructor. |
||
25 | * |
||
26 | * @param string $type |
||
27 | * @param AnnotationType|null $next |
||
|
|||
28 | */ |
||
29 | private function __construct(string $type, self $next = null) |
||
34 | |||
35 | /** |
||
36 | * @param string $type |
||
37 | * |
||
38 | * @return AnnotationType |
||
39 | */ |
||
40 | public static function parse(string $type): self |
||
54 | |||
55 | /** |
||
56 | * @return Type |
||
57 | */ |
||
58 | public function getType(): Type |
||
62 | |||
63 | /** |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function hasNext(): bool |
||
70 | |||
71 | /** |
||
72 | * @return AnnotationType |
||
73 | */ |
||
74 | public function next(): self |
||
78 | |||
79 | /** |
||
80 | * @param $expression |
||
81 | * |
||
82 | * @return bool |
||
83 | */ |
||
84 | public function isImplicit($expression): bool |
||
95 | |||
96 | /** |
||
97 | * @param $expression |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function isSame($expression): bool |
||
112 | |||
113 | /** |
||
114 | * @param array $expression |
||
115 | * @param callable $callback |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | private function compare(array $expression, callable $callback): bool |
||
129 | |||
130 | /** |
||
131 | * @return int |
||
132 | */ |
||
133 | public function getDimension(): int |
||
139 | |||
140 | /** |
||
141 | * @return Type |
||
142 | */ |
||
143 | public function getBaseType(): Type |
||
147 | |||
148 | /** |
||
149 | * @param int|null $dimension |
||
150 | * |
||
151 | * @return AnnotationType |
||
152 | */ |
||
153 | private function iterate(int &$dimension = null): AnnotationType |
||
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | public function export(): string |
||
172 | } |
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.