From eca9bf277c5045e0cd45da570b91f2635a46d721 Mon Sep 17 00:00:00 2001 From: James Gilliland Date: Thu, 23 Jun 2022 13:47:11 -0500 Subject: [PATCH] Optimize type specification intersect logic Don't know if this will have side effects so testing needed but if it works... oh lord. Fixes #7421 Slow processing of Class::* type hints --- src/Analyser/TypeSpecifier.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Analyser/TypeSpecifier.php b/src/Analyser/TypeSpecifier.php index 37299b5d856..da49596ba9c 100644 --- a/src/Analyser/TypeSpecifier.php +++ b/src/Analyser/TypeSpecifier.php @@ -342,9 +342,8 @@ public function specifyTypesInCondition( } if ($context->true()) { - $type = TypeCombinator::intersect($scope->getType($expr->right), $scope->getType($expr->left)); - $leftTypes = $this->create($expr->left, $type, $context, false, $scope, $rootExpr); - $rightTypes = $this->create($expr->right, $type, $context, false, $scope, $rootExpr); + $leftTypes = $this->create($expr->left, $exprRightType, $context, false, $scope, $rootExpr); + $rightTypes = $this->create($expr->right, $exprLeftType, $context, false, $scope, $rootExpr); return $leftTypes->unionWith($rightTypes); } elseif ($context->false()) { return $this->create($expr->left, $exprLeftType, $context, false, $scope, $rootExpr)->normalize($scope)