@@ -171,9 +171,7 @@ private function getDocBlockFromConstructor(string $class, string $property): ?P
171171 }
172172
173173 $ rawDocNode = $ reflectionConstructor ->getDocComment ();
174- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
175- $ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
176- $ tokens ->consumeTokenType (Lexer::TOKEN_END );
174+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
177175
178176 return $ this ->filterDocBlockParams ($ phpDocNode , $ property );
179177 }
@@ -243,9 +241,7 @@ private function getDocBlockFromProperty(string $class, string $property): ?arra
243241 return null ;
244242 }
245243
246- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
247- $ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
248- $ tokens ->consumeTokenType (Lexer::TOKEN_END );
244+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
249245
250246 return [$ phpDocNode , $ source , $ reflectionProperty ->class ];
251247 }
@@ -286,10 +282,17 @@ private function getDocBlockFromMethod(string $class, string $ucFirstProperty, i
286282 return null ;
287283 }
288284
289- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
285+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
286+
287+ return [$ phpDocNode , $ prefix , $ reflectionMethod ->class ];
288+ }
289+
290+ private function getPhpDocNode (string $ rawDocNode ): PhpDocNode
291+ {
292+ $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
290293 $ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
291294 $ tokens ->consumeTokenType (Lexer::TOKEN_END );
292295
293- return [ $ phpDocNode, $ prefix , $ reflectionMethod -> class ] ;
296+ return $ phpDocNode ;
294297 }
295298}
0 commit comments