diff --git a/src/Analyser/TypeSpecifier.php b/src/Analyser/TypeSpecifier.php index 9bf24f318d..356d0b30be 100644 --- a/src/Analyser/TypeSpecifier.php +++ b/src/Analyser/TypeSpecifier.php @@ -1074,13 +1074,7 @@ private function specifyTypesForConstantBinaryExpression( ?Expr $rootExpr, ): ?SpecifiedTypes { - $scalarValues = $constantType->getConstantScalarValues(); - if (count($scalarValues) !== 1) { - return null; - } - $constValue = $scalarValues[0]; - - if (!$context->null() && $constValue === false) { + if (!$context->null() && $constantType->isFalse()->yes()) { $types = $this->create($exprNode, $constantType, $context, false, $scope, $rootExpr); if ($exprNode instanceof Expr\NullsafeMethodCall || $exprNode instanceof Expr\NullsafePropertyFetch) { return $types; @@ -1094,7 +1088,7 @@ private function specifyTypesForConstantBinaryExpression( )); } - if (!$context->null() && $constValue === true) { + if (!$context->null() && $constantType->isTrue()->yes()) { $types = $this->create($exprNode, $constantType, $context, false, $scope, $rootExpr); if ($exprNode instanceof Expr\NullsafeMethodCall || $exprNode instanceof Expr\NullsafePropertyFetch) { return $types;