2222use PHPStan \Node \Expr \AlwaysRememberedExpr ;
2323use PHPStan \Node \IssetExpr ;
2424use PHPStan \Node \Printer \ExprPrinter ;
25+ use PHPStan \Php \PhpVersion ;
2526use PHPStan \Reflection \Assertions ;
2627use PHPStan \Reflection \ParametersAcceptor ;
2728use PHPStan \Reflection \ParametersAcceptorSelector ;
@@ -100,6 +101,7 @@ final class TypeSpecifier
100101 public function __construct (
101102 private ExprPrinter $ exprPrinter ,
102103 private ReflectionProvider $ reflectionProvider ,
104+ private PhpVersion $ phpVersion ,
103105 private array $ functionTypeSpecifyingExtensions ,
104106 private array $ methodTypeSpecifyingExtensions ,
105107 private array $ staticMethodTypeSpecifyingExtensions ,
@@ -406,7 +408,7 @@ public function specifyTypesInCondition(
406408 $ result = $ result ->unionWith (
407409 $ this ->create (
408410 $ expr ->left ,
409- $ orEqual ? $ rightType ->getSmallerOrEqualType () : $ rightType ->getSmallerType (),
411+ $ orEqual ? $ rightType ->getSmallerOrEqualType ($ this -> phpVersion ) : $ rightType ->getSmallerType ($ this -> phpVersion ),
410412 TypeSpecifierContext::createTruthy (),
411413 $ scope ,
412414 )->setRootExpr ($ expr ),
@@ -416,7 +418,7 @@ public function specifyTypesInCondition(
416418 $ result = $ result ->unionWith (
417419 $ this ->create (
418420 $ expr ->right ,
419- $ orEqual ? $ leftType ->getGreaterOrEqualType () : $ leftType ->getGreaterType (),
421+ $ orEqual ? $ leftType ->getGreaterOrEqualType ($ this -> phpVersion ) : $ leftType ->getGreaterType ($ this -> phpVersion ),
420422 TypeSpecifierContext::createTruthy (),
421423 $ scope ,
422424 )->setRootExpr ($ expr ),
@@ -427,7 +429,7 @@ public function specifyTypesInCondition(
427429 $ result = $ result ->unionWith (
428430 $ this ->create (
429431 $ expr ->left ,
430- $ orEqual ? $ rightType ->getGreaterType () : $ rightType ->getGreaterOrEqualType (),
432+ $ orEqual ? $ rightType ->getGreaterType ($ this -> phpVersion ) : $ rightType ->getGreaterOrEqualType ($ this -> phpVersion ),
431433 TypeSpecifierContext::createTruthy (),
432434 $ scope ,
433435 )->setRootExpr ($ expr ),
@@ -437,7 +439,7 @@ public function specifyTypesInCondition(
437439 $ result = $ result ->unionWith (
438440 $ this ->create (
439441 $ expr ->right ,
440- $ orEqual ? $ leftType ->getSmallerType () : $ leftType ->getSmallerOrEqualType (),
442+ $ orEqual ? $ leftType ->getSmallerType ($ this -> phpVersion ) : $ leftType ->getSmallerOrEqualType ($ this -> phpVersion ),
441443 TypeSpecifierContext::createTruthy (),
442444 $ scope ,
443445 )->setRootExpr ($ expr ),
0 commit comments