@@ -4571,35 +4571,8 @@ public function addTypeToExpression(Expr $expr, Type $type): self
45714571 if ($ originalExprType ->equals ($ nativeType )) {
45724572 $ newType = TypeCombinator::intersect ($ type , $ originalExprType );
45734573 if ($ newType ->isConstantScalarValue ()->yes () && $ newType ->equals ($ originalExprType )) {
4574- $ exprString = $ this ->getNodeKey ($ expr );
4575- if (array_key_exists ($ exprString , $ this ->expressionTypes )) {
4576- // don't add the same type over and over again to improve performance
4577- return $ this ;
4578- }
4579-
4580- $ expressionTypes = $ this ->expressionTypes ;
4581- $ expressionTypes [$ exprString ] = new ExpressionTypeHolder ($ expr , $ type , TrinaryLogic::createYes ());
4582- $ nativeTypes = $ this ->nativeExpressionTypes ;
4583- $ nativeTypes [$ exprString ] = new ExpressionTypeHolder ($ expr , $ nativeType , TrinaryLogic::createYes ());
4584-
4585- return $ this ->scopeFactory ->create (
4586- $ this ->context ,
4587- $ this ->isDeclareStrictTypes (),
4588- $ this ->getFunction (),
4589- $ this ->getNamespace (),
4590- $ expressionTypes ,
4591- $ nativeTypes ,
4592- $ this ->conditionalExpressions ,
4593- $ this ->inClosureBindScopeClasses ,
4594- $ this ->anonymousFunctionReflection ,
4595- $ this ->inFirstLevelStatement ,
4596- $ this ->currentlyAssignedExpressions ,
4597- $ this ->currentlyAllowedUndefinedExpressions ,
4598- $ this ->inFunctionCallsStack ,
4599- $ this ->afterExtractCall ,
4600- $ this ->parentScope ,
4601- $ this ->nativeTypesPromoted ,
4602- );
4574+ // don't add the same type over and over again to improve performance
4575+ return $ this ;
46034576 }
46044577 return $ this ->specifyExpressionType ($ expr , $ newType , $ newType , TrinaryLogic::createYes ());
46054578 }
0 commit comments