33namespace PHPStan \Type \Nette ;
44
55use Nette \Utils \Strings ;
6- use PhpParser \Node \Arg ;
76use PhpParser \Node \Expr \StaticCall ;
87use PHPStan \Analyser \Scope ;
98use PHPStan \Analyser \SpecifiedTypes ;
109use PHPStan \Analyser \TypeSpecifier ;
10+ use PHPStan \Analyser \TypeSpecifierAwareExtension ;
1111use PHPStan \Analyser \TypeSpecifierContext ;
1212use PHPStan \Reflection \MethodReflection ;
13- use PHPStan \TrinaryLogic ;
14- use PHPStan \Type \Constant \ConstantBooleanType ;
15- use PHPStan \Type \Constant \ConstantIntegerType ;
16- use PHPStan \Type \DynamicStaticMethodReturnTypeExtension ;
17- use PHPStan \Type \NullType ;
1813use PHPStan \Type \Php \RegexArrayShapeMatcher ;
1914use PHPStan \Type \StaticMethodTypeSpecifyingExtension ;
20- use PHPStan \Type \Type ;
21- use PHPStan \Type \TypeCombinator ;
22- use function array_key_exists ;
23- use const PREG_OFFSET_CAPTURE ;
24- use const PREG_UNMATCHED_AS_NULL ;
15+ use function in_array ;
2516
26- class StringsMatchTypeSpecifiyingExtension implements StaticMethodTypeSpecifyingExtension
17+ class StringsMatchTypeSpecifiyingExtension implements StaticMethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
2718{
19+
2820 private RegexArrayShapeMatcher $ regexArrayShapeMatcher ;
2921
3022 private TypeSpecifier $ typeSpecifier ;
@@ -46,7 +38,7 @@ public function getClass(): string
4638
4739 public function isStaticMethodSupported (MethodReflection $ staticMethodReflection , StaticCall $ node , TypeSpecifierContext $ context ): bool
4840 {
49- return $ context ->true () && $ staticMethodReflection ->getName () === 'match ' ;
41+ return $ context ->true () && in_array ( $ staticMethodReflection ->getName (), [ 'match ' , ' matchAll ' ], true ) ;
5042 }
5143
5244 public function specifyTypes (MethodReflection $ staticMethodReflection , StaticCall $ node , Scope $ scope , TypeSpecifierContext $ context ): SpecifiedTypes
@@ -78,4 +70,5 @@ public function specifyTypes(MethodReflection $staticMethodReflection, StaticCal
7870
7971 return $ subjectTypes ;
8072 }
73+
8174}
0 commit comments