1 | <?php |
||
9 | final class AnnotationParser |
||
10 | { |
||
11 | const REGEX = '\s+(.*?)\s*(\$.+?)?\s*\z'; |
||
12 | |||
13 | /** |
||
14 | * @param string $comment |
||
15 | * |
||
16 | * @return VariableAnnotation[] |
||
17 | */ |
||
18 | public function parseParameterAnnotations(string $comment): array |
||
22 | |||
23 | /** |
||
24 | * @param string $comment |
||
25 | * |
||
26 | * @return VariableAnnotation[] |
||
27 | */ |
||
28 | public function parseVariableAnnotations(string $comment): array |
||
32 | |||
33 | /** |
||
34 | * @param string $comment |
||
35 | * |
||
36 | * @return VariableAnnotation[] |
||
37 | */ |
||
38 | public function parsePropertyAnnotations(string $comment): array |
||
42 | |||
43 | /** |
||
44 | * @param string $annotation |
||
45 | * @param string $comment |
||
46 | * |
||
47 | * @return VariableAnnotation[] |
||
48 | */ |
||
49 | private function parseAnnotations(string $annotation, string $comment): array |
||
61 | |||
62 | /** |
||
63 | * @param string $annotation |
||
64 | * @param string $line |
||
65 | * |
||
66 | * @return VariableAnnotation|null |
||
67 | */ |
||
68 | private function parseAnnotation(string $annotation, string $line): ?VariableAnnotation |
||
79 | |||
80 | /** |
||
81 | * @param array $matches |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | private function parseAnnotationMatch(array $matches): array |
||
98 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.