@@ -171,9 +171,7 @@ private function getDocBlockFromConstructor(string $class, string $property): ?P
171
171
}
172
172
173
173
$ 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 );
177
175
178
176
return $ this ->filterDocBlockParams ($ phpDocNode , $ property );
179
177
}
@@ -243,9 +241,7 @@ private function getDocBlockFromProperty(string $class, string $property): ?arra
243
241
return null ;
244
242
}
245
243
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 );
249
245
250
246
return [$ phpDocNode , $ source , $ reflectionProperty ->class ];
251
247
}
@@ -286,10 +282,17 @@ private function getDocBlockFromMethod(string $class, string $ucFirstProperty, i
286
282
return null ;
287
283
}
288
284
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 ));
290
293
$ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
291
294
$ tokens ->consumeTokenType (Lexer::TOKEN_END );
292
295
293
- return [ $ phpDocNode, $ prefix , $ reflectionMethod -> class ] ;
296
+ return $ phpDocNode ;
294
297
}
295
298
}
0 commit comments