77use PHPStan \DependencyInjection \AutowiredService ;
88use PHPStan \Reflection \FunctionReflection ;
99use PHPStan \TrinaryLogic ;
10+ use PHPStan \Type \BenevolentUnionType ;
1011use PHPStan \Type \Constant \ConstantArrayType ;
1112use PHPStan \Type \Constant \ConstantIntegerType ;
1213use PHPStan \Type \DynamicFunctionReturnTypeExtension ;
1314use PHPStan \Type \FloatType ;
14- use PHPStan \Type \IntegerType ;
15+ use PHPStan \Type \IntegerRangeType ;
1516use PHPStan \Type \Type ;
1617use PHPStan \Type \TypeCombinator ;
17- use PHPStan \Type \TypeUtils ;
1818use function count ;
1919
2020#[AutowiredService]
@@ -28,8 +28,13 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
2828
2929 public function getTypeFromFunctionCall (FunctionReflection $ functionReflection , FuncCall $ functionCall , Scope $ scope ): Type
3030 {
31- $ arrayType = new ConstantArrayType ([new ConstantIntegerType (0 ), new ConstantIntegerType (1 )], [new IntegerType (), new IntegerType ()], [2 ], isList: TrinaryLogic::createYes ());
32- $ numberType = TypeUtils::toBenevolentUnion (TypeCombinator::union (new IntegerType (), new FloatType ()));
31+ $ arrayType = new ConstantArrayType (
32+ [new ConstantIntegerType (0 ), new ConstantIntegerType (1 )],
33+ [IntegerRangeType::fromInterval (1 , null ), IntegerRangeType::fromInterval (0 , 999999999 )],
34+ [2 ],
35+ isList: TrinaryLogic::createYes (),
36+ );
37+ $ numberType = new BenevolentUnionType ([IntegerRangeType::fromInterval (1 , null ), new FloatType ()]);
3338
3439 if (count ($ functionCall ->getArgs ()) < 1 ) {
3540 return $ arrayType ;
0 commit comments