@@ -2528,36 +2528,10 @@ public function processExprNode(
25282528 continue ;
25292529 }
25302530
2531- $ handlerResult = $ exprHandler ->processExpr ($ this , $ stmt , $ expr , $ scope , $ storage , $ nodeCallback , $ context );
2532-
2533- if ($ expr instanceof MethodCall) {
2534- $ handlerResult = $ this ->processMethodCallInitializedProperties ($ expr , $ scope , $ handlerResult );
2535- }
2536-
2537- return $ handlerResult ;
2531+ return $ exprHandler ->processExpr ($ this , $ stmt , $ expr , $ scope , $ storage , $ nodeCallback , $ context );
25382532 }
25392533
2540- if ($ expr instanceof Expr \Closure) {
2541- $ processClosureResult = $ this ->processClosureNode ($ stmt , $ expr , $ scope , $ storage , $ nodeCallback , $ context , null );
2542- $ scope = $ processClosureResult ->applyByRefUseScope ($ processClosureResult ->getScope ());
2543-
2544- return new ExpressionResult (
2545- $ scope ,
2546- false ,
2547- false ,
2548- [],
2549- [],
2550- );
2551- } elseif ($ expr instanceof Expr \ArrowFunction) {
2552- $ result = $ this ->processArrowFunctionNode ($ stmt , $ expr , $ scope , $ storage , $ nodeCallback , null );
2553- return new ExpressionResult (
2554- $ result ->getScope (),
2555- $ result ->hasYield (),
2556- false ,
2557- [],
2558- [],
2559- );
2560- } elseif ($ expr instanceof List_) {
2534+ if ($ expr instanceof List_) {
25612535 // only in assign and foreach, processed elsewhere
25622536 return new ExpressionResult ($ scope , hasYield: false , isAlwaysTerminating: false , throwPoints: [], impurePoints: []);
25632537 } elseif ($ expr instanceof AlwaysRememberedExpr) {
@@ -5027,42 +5001,6 @@ private function processNodesForTraitUse($node, ClassReflection $traitReflection
50275001 }
50285002 }
50295003
5030- private function processMethodCallInitializedProperties (MethodCall $ expr , MutatingScope $ originalScope , ExpressionResult $ handlerResult ): ExpressionResult
5031- {
5032- $ scope = $ handlerResult ->getScope ();
5033- $ calledOnType = $ originalScope ->getType ($ expr ->var );
5034- if ($ expr ->name instanceof Expr) {
5035- return $ handlerResult ;
5036- }
5037- $ methodName = $ expr ->name ->name ;
5038- $ methodReflection = $ originalScope ->getMethodReflection ($ calledOnType , $ methodName );
5039- if ($ methodReflection === null ) {
5040- return $ handlerResult ;
5041- }
5042- if (
5043- $ scope ->isInClass ()
5044- && $ scope ->getClassReflection ()->getName () === $ methodReflection ->getDeclaringClass ()->getName ()
5045- && ($ scope ->getFunctionName () !== null && strtolower ($ scope ->getFunctionName ()) === '__construct ' )
5046- && TypeUtils::findThisType ($ calledOnType ) !== null
5047- ) {
5048- $ calledMethodScope = $ this ->processCalledMethod ($ methodReflection );
5049- if ($ calledMethodScope !== null ) {
5050- $ scope = $ scope ->mergeInitializedProperties ($ calledMethodScope );
5051- return new ExpressionResult (
5052- $ scope ,
5053- hasYield: $ handlerResult ->hasYield (),
5054- isAlwaysTerminating: $ handlerResult ->isAlwaysTerminating (),
5055- throwPoints: $ handlerResult ->getThrowPoints (),
5056- impurePoints: $ handlerResult ->getImpurePoints (),
5057- truthyScopeCallback: static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
5058- falseyScopeCallback: static fn (): MutatingScope => $ scope ->filterByFalseyValue ($ expr ),
5059- );
5060- }
5061- }
5062-
5063- return $ handlerResult ;
5064- }
5065-
50665004 public function processCalledMethod (MethodReflection $ methodReflection ): ?MutatingScope
50675005 {
50685006 $ declaringClass = $ methodReflection ->getDeclaringClass ();
0 commit comments