1 | <?php |
||
16 | class DynamicParser implements ParserInterface |
||
17 | { |
||
18 | const TOKEN_ANNOTATION_IDENTIFIER = '@'; |
||
19 | |||
20 | const TOKEN_ANNOTATION_NAME = '[a-zA-Z\_\-\\\][a-zA-Z0-9\_\-\.\\\]*'; |
||
21 | |||
22 | /** |
||
23 | * The regex to extract data from a single line |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $dataPattern; |
||
28 | |||
29 | /** |
||
30 | * Parser constructor |
||
31 | * |
||
32 | */ |
||
33 | public function __construct() |
||
39 | |||
40 | /** |
||
41 | * Parse a given docblock |
||
42 | * |
||
43 | * @param string $docblock |
||
44 | * @return array |
||
45 | */ |
||
46 | public function parse($docblock) |
||
58 | |||
59 | /** |
||
60 | * Filters docblock tags section, removing unwanted long and short descriptions |
||
61 | * |
||
62 | * @param string $docblock A docblok string without delimiters |
||
63 | * @return string Tag section from given docblock |
||
64 | */ |
||
65 | protected function getDocblockTagsSection($docblock) |
||
73 | |||
74 | /** |
||
75 | * Filters docblock delimiters |
||
76 | * |
||
77 | * @param string $docblock A raw docblok string |
||
78 | * @return string A docblok string without delimiters |
||
79 | */ |
||
80 | protected function sanitizeDocblock($docblock) |
||
84 | |||
85 | /** |
||
86 | * Creates raw [annotation => value, [...]] tree |
||
87 | * |
||
88 | * @param string $str |
||
89 | * @return array |
||
90 | */ |
||
91 | protected function parseAnnotations($str) |
||
101 | |||
102 | /** |
||
103 | * Parse a single annotation value |
||
104 | * |
||
105 | * @param string $value |
||
106 | * @param string $key |
||
107 | * @return mixed |
||
108 | */ |
||
109 | protected function parseValue($value, $key = null) |
||
113 | |||
114 | /** |
||
115 | * Just a hook so derived parsers can transform annotation identifiers before they go to AST |
||
116 | * |
||
117 | * @param string $key |
||
118 | * @return string |
||
119 | */ |
||
120 | protected function sanitizeKey($key) |
||
124 | } |
||
125 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.