@@ -228,6 +228,10 @@ private function handleTypedProperty(Node $node): void
228228 return ;
229229 }
230230
231+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
232+ return ;
233+ }
234+
231235 try {
232236 $ this ->classDescriptionBuilder
233237 ->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
@@ -288,10 +292,17 @@ private function handleReturnTypeDependency(Node $node): void
288292 {
289293 if ($ node instanceof Node \Stmt \ClassMethod) {
290294 $ returnType = $ node ->returnType ;
291- if ( $ returnType instanceof Node \ Name \FullyQualified) {
292- $ this -> classDescriptionBuilder
293- -> addDependency ( new ClassDependency ( $ returnType -> toString (), $ returnType -> getLine ())) ;
295+
296+ if (! $ returnType instanceof Node \ Name \FullyQualified) {
297+ return ;
294298 }
299+
300+ if (FullyQualifiedClassName::isNotAValidFqcn ($ returnType ->toString ())) {
301+ return ;
302+ }
303+
304+ $ this ->classDescriptionBuilder
305+ ->addDependency (new ClassDependency ($ returnType ->toString (), $ returnType ->getLine ()));
295306 }
296307 }
297308
@@ -300,10 +311,16 @@ private function handleAttributeNode(Node $node): void
300311 if ($ node instanceof Node \Attribute) {
301312 $ nodeName = $ node ->name ;
302313
303- if ($ nodeName instanceof Node \Name \FullyQualified) {
304- $ this ->classDescriptionBuilder
305- ->addAttribute ($ node ->name ->toString (), $ node ->getLine ());
314+ if (!$ nodeName instanceof Node \Name \FullyQualified) {
315+ return ;
316+ }
317+
318+ if (FullyQualifiedClassName::isNotAValidFqcn ($ nodeName ->toString ())) {
319+ return ;
306320 }
321+
322+ $ this ->classDescriptionBuilder
323+ ->addAttribute ($ nodeName ->toString (), $ node ->getLine ());
307324 }
308325 }
309326
@@ -337,6 +354,10 @@ private function addParamDependency(Node\Param $node): void
337354 return ;
338355 }
339356
357+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
358+ return ;
359+ }
360+
340361 $ this ->classDescriptionBuilder
341362 ->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
342363 }
0 commit comments