@@ -183,9 +183,7 @@ private function getDocBlockFromConstructor(string $class, string $property): ?P
183
183
return null ;
184
184
}
185
185
186
- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
187
- $ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
188
- $ tokens ->consumeTokenType (Lexer::TOKEN_END );
186
+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
189
187
190
188
return $ this ->filterDocBlockParams ($ phpDocNode , $ property );
191
189
}
@@ -253,9 +251,7 @@ private function getDocBlockFromProperty(string $class, string $property): ?arra
253
251
return null ;
254
252
}
255
253
256
- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
257
- $ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
258
- $ tokens ->consumeTokenType (Lexer::TOKEN_END );
254
+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
259
255
260
256
return [$ phpDocNode , $ source , $ reflectionProperty ->class ];
261
257
}
@@ -296,10 +292,17 @@ private function getDocBlockFromMethod(string $class, string $ucFirstProperty, i
296
292
return null ;
297
293
}
298
294
299
- $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
295
+ $ phpDocNode = $ this ->getPhpDocNode ($ rawDocNode );
296
+
297
+ return [$ phpDocNode , $ prefix , $ reflectionMethod ->class ];
298
+ }
299
+
300
+ private function getPhpDocNode (string $ rawDocNode ): PhpDocNode
301
+ {
302
+ $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ rawDocNode ));
300
303
$ phpDocNode = $ this ->phpDocParser ->parse ($ tokens );
301
304
$ tokens ->consumeTokenType (Lexer::TOKEN_END );
302
305
303
- return [ $ phpDocNode, $ prefix , $ reflectionMethod -> class ] ;
306
+ return $ phpDocNode ;
304
307
}
305
308
}
0 commit comments