File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,10 @@ private function handleTypedProperty(Node $node): void
247247 return ;
248248 }
249249
250+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
251+ return ;
252+ }
253+
250254 $ this ->classDescriptionBuilder
251255 ->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
252256 }
@@ -314,6 +318,10 @@ private function handleReturnTypeDependency(Node $node): void
314318 return ;
315319 }
316320
321+ if (FullyQualifiedClassName::isNotAValidFqcn ($ returnType ->toString ())) {
322+ return ;
323+ }
324+
317325 $ this ->classDescriptionBuilder
318326 ->addDependency (new ClassDependency ($ returnType ->toString (), $ returnType ->getLine ()));
319327 }
@@ -330,6 +338,10 @@ private function handleAttributeNode(Node $node): void
330338 return ;
331339 }
332340
341+ if (FullyQualifiedClassName::isNotAValidFqcn ($ nodeName ->toString ())) {
342+ return ;
343+ }
344+
333345 $ this ->classDescriptionBuilder
334346 ->addAttribute ($ node ->name ->toString (), $ node ->getLine ());
335347 }
@@ -346,6 +358,10 @@ private function addParamDependency(Node\Param $node): void
346358 return ;
347359 }
348360
361+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
362+ return ;
363+ }
364+
349365 $ this ->classDescriptionBuilder
350366 ->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
351367 }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function toString(): string
2727
2828 public function classMatches (string $ pattern ): bool
2929 {
30- if ($ this -> isNotAValidPattern ($ pattern )) {
30+ if (self :: isNotAValidFqcn ($ pattern )) {
3131 throw new InvalidPatternException ("' $ pattern' is not a valid class or namespace pattern. Regex are not allowed, only * and ? wildcard. " );
3232 }
3333
@@ -36,7 +36,7 @@ public function classMatches(string $pattern): bool
3636
3737 public function matches (string $ pattern ): bool
3838 {
39- if ($ this -> isNotAValidPattern ($ pattern )) {
39+ if (self :: isNotAValidFqcn ($ pattern )) {
4040 throw new InvalidPatternException ("' $ pattern' is not a valid class or namespace pattern. Regex are not allowed, only * and ? wildcard. " );
4141 }
4242
@@ -69,12 +69,12 @@ public static function fromString(string $fqcn): self
6969 return new self (new PatternString ($ fqcn ), new PatternString ($ namespace ), new PatternString ($ className ));
7070 }
7171
72- public function isNotAValidPattern (string $ pattern ): bool
72+ public static function isNotAValidFqcn (string $ fqcn ): bool
7373 {
7474 $ validClassNameCharacters = '[a-zA-Z0-9_\x80-\xff] ' ;
7575 $ or = '| ' ;
7676 $ backslash = '\\\\' ;
7777
78- return 0 === preg_match ('/^( ' .$ validClassNameCharacters .$ or .$ backslash .$ or .'\* ' .$ or .'\?)*$/ ' , $ pattern );
78+ return 0 === preg_match ('/^( ' .$ validClassNameCharacters .$ or .$ backslash .$ or .'\* ' .$ or .'\?)*$/ ' , $ fqcn );
7979 }
8080}
You can’t perform that action at this time.
0 commit comments