1515use  PhpParser \Node \Stmt \Return_ ;
1616use  PHPStan \Analyser \MutatingScope ;
1717use  PHPStan \Analyser \Scope ;
18- use  PHPStan \Reflection \FunctionReflection ;
1918use  PHPStan \Reflection \ReflectionProvider ;
2019use  PHPStan \ShouldNotHappenException ;
2120use  PHPStan \Type \ArrayType ;
2423use  PHPStan \Type \Constant \ConstantArrayTypeBuilder ;
2524use  PHPStan \Type \Constant \ConstantBooleanType ;
2625use  PHPStan \Type \Constant \ConstantIntegerType ;
27- use  PHPStan \Type \DynamicFunctionReturnTypeExtension ;
2826use  PHPStan \Type \ErrorType ;
2927use  PHPStan \Type \MixedType ;
3028use  PHPStan \Type \NeverType ;
4038use  function  sprintf ;
4139use  function  substr ;
4240
43- final  class  ArrayFilterFunctionReturnTypeExtension  implements  DynamicFunctionReturnTypeExtension 
41+ final  class  ArrayFilterFunctionReturnTypeHelper 
4442{
4543
4644private  const  USE_BOTH  = 1 ;
@@ -51,17 +49,8 @@ public function __construct(private ReflectionProvider $reflectionProvider)
5149{
5250}
5351
54- public  function  isFunctionSupported ( FunctionReflection   $ functionReflection bool 
52+ public  function  getType ( Scope   $ scope , ? Expr   $ arrayArg , ? Expr   $ callbackArg , ? Expr   $ flagArg Type 
5553{
56- return  $ functionReflectiongetName () === 'array_filter ' ;
57- }
58- 
59- public  function  getTypeFromFunctionCall (FunctionReflection $ functionReflectionFuncCall $ functionCallScope $ scopeType 
60- {
61- $ arrayArg$ functionCallgetArgs ()[0 ]->value  ?? null ;
62- $ callbackArg$ functionCallgetArgs ()[1 ]->value  ?? null ;
63- $ flagArg$ functionCallgetArgs ()[2 ]->value  ?? null ;
64- 
6554if  ($ arrayArgnull ) {
6655return  new  ArrayType (new  MixedType (), new  MixedType ());
6756}
@@ -151,7 +140,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
151140return  new  ArrayType ($ keyType$ itemType
152141}
153142
154- public  function  removeFalsey (Type $ typeType 
143+ private  function  removeFalsey (Type $ typeType 
155144{
156145$ falseyTypesfalsey ();
157146
0 commit comments