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
247
247
return ;
248
248
}
249
249
250
+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
251
+ return ;
252
+ }
253
+
250
254
$ this ->classDescriptionBuilder
251
255
->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
252
256
}
@@ -314,6 +318,10 @@ private function handleReturnTypeDependency(Node $node): void
314
318
return ;
315
319
}
316
320
321
+ if (FullyQualifiedClassName::isNotAValidFqcn ($ returnType ->toString ())) {
322
+ return ;
323
+ }
324
+
317
325
$ this ->classDescriptionBuilder
318
326
->addDependency (new ClassDependency ($ returnType ->toString (), $ returnType ->getLine ()));
319
327
}
@@ -330,6 +338,10 @@ private function handleAttributeNode(Node $node): void
330
338
return ;
331
339
}
332
340
341
+ if (FullyQualifiedClassName::isNotAValidFqcn ($ nodeName ->toString ())) {
342
+ return ;
343
+ }
344
+
333
345
$ this ->classDescriptionBuilder
334
346
->addAttribute ($ node ->name ->toString (), $ node ->getLine ());
335
347
}
@@ -346,6 +358,10 @@ private function addParamDependency(Node\Param $node): void
346
358
return ;
347
359
}
348
360
361
+ if (FullyQualifiedClassName::isNotAValidFqcn ($ type ->toString ())) {
362
+ return ;
363
+ }
364
+
349
365
$ this ->classDescriptionBuilder
350
366
->addDependency (new ClassDependency ($ type ->toString (), $ node ->getLine ()));
351
367
}
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function toString(): string
27
27
28
28
public function classMatches (string $ pattern ): bool
29
29
{
30
- if ($ this -> isNotAValidPattern ($ pattern )) {
30
+ if (self :: isNotAValidFqcn ($ pattern )) {
31
31
throw new InvalidPatternException ("' $ pattern' is not a valid class or namespace pattern. Regex are not allowed, only * and ? wildcard. " );
32
32
}
33
33
@@ -36,7 +36,7 @@ public function classMatches(string $pattern): bool
36
36
37
37
public function matches (string $ pattern ): bool
38
38
{
39
- if ($ this -> isNotAValidPattern ($ pattern )) {
39
+ if (self :: isNotAValidFqcn ($ pattern )) {
40
40
throw new InvalidPatternException ("' $ pattern' is not a valid class or namespace pattern. Regex are not allowed, only * and ? wildcard. " );
41
41
}
42
42
@@ -69,12 +69,12 @@ public static function fromString(string $fqcn): self
69
69
return new self (new PatternString ($ fqcn ), new PatternString ($ namespace ), new PatternString ($ className ));
70
70
}
71
71
72
- public function isNotAValidPattern (string $ pattern ): bool
72
+ public static function isNotAValidFqcn (string $ fqcn ): bool
73
73
{
74
74
$ validClassNameCharacters = '[a-zA-Z0-9_\x80-\xff] ' ;
75
75
$ or = '| ' ;
76
76
$ backslash = '\\\\' ;
77
77
78
- return 0 === preg_match ('/^( ' .$ validClassNameCharacters .$ or .$ backslash .$ or .'\* ' .$ or .'\?)*$/ ' , $ pattern );
78
+ return 0 === preg_match ('/^( ' .$ validClassNameCharacters .$ or .$ backslash .$ or .'\* ' .$ or .'\?)*$/ ' , $ fqcn );
79
79
}
80
80
}
You can’t perform that action at this time.
0 commit comments