@@ -3186,24 +3186,12 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
31863186 $ impurePoints = [];
31873187 $ isAlwaysTerminating = false ;
31883188 if ($ expr ->class instanceof Expr) {
3189- $ objectClasses = $ scope ->getType ($ expr ->class )->getObjectClassNames ();
3190- if (count ($ objectClasses ) !== 1 ) {
3191- $ objectClasses = $ scope ->getType (new New_ ($ expr ->class ))->getObjectClassNames ();
3192- }
3193- if (count ($ objectClasses ) === 1 ) {
3194- $ objectExprResult = $ this ->processExprNode ($ stmt , new StaticCall (new Name ($ objectClasses [0 ]), $ expr ->name , []), $ scope , $ storage , new NoopNodeCallback (), $ context ->enterDeep ());
3195- $ additionalThrowPoints = $ objectExprResult ->getThrowPoints ();
3196- } else {
3197- $ additionalThrowPoints = [InternalThrowPoint::createImplicit ($ scope , $ expr )];
3198- }
31993189 $ classResult = $ this ->processExprNode ($ stmt , $ expr ->class , $ scope , $ storage , $ nodeCallback , $ context ->enterDeep ());
32003190 $ hasYield = $ classResult ->hasYield ();
32013191 $ throwPoints = array_merge ($ throwPoints , $ classResult ->getThrowPoints ());
32023192 $ impurePoints = array_merge ($ impurePoints , $ classResult ->getImpurePoints ());
32033193 $ isAlwaysTerminating = $ classResult ->isAlwaysTerminating ();
3204- foreach ($ additionalThrowPoints as $ throwPoint ) {
3205- $ throwPoints [] = $ throwPoint ;
3206- }
3194+
32073195 $ scope = $ classResult ->getScope ();
32083196 }
32093197
@@ -3279,6 +3267,22 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
32793267 }
32803268 }
32813269
3270+ if ($ expr ->class instanceof Expr) {
3271+ $ objectClasses = $ scope ->getType ($ expr ->class )->getObjectClassNames ();
3272+ if (count ($ objectClasses ) !== 1 ) {
3273+ $ objectClasses = $ scope ->getType (new New_ ($ expr ->class ))->getObjectClassNames ();
3274+ }
3275+ if (count ($ objectClasses ) === 1 ) {
3276+ $ objectExprResult = $ this ->processExprNode ($ stmt , new StaticCall (new Name ($ objectClasses [0 ]), $ expr ->name , []), $ scope , $ storage , new NoopNodeCallback (), $ context ->enterDeep ());
3277+ $ additionalThrowPoints = $ objectExprResult ->getThrowPoints ();
3278+ } else {
3279+ $ additionalThrowPoints = [InternalThrowPoint::createImplicit ($ scope , $ expr )];
3280+ }
3281+ foreach ($ additionalThrowPoints as $ throwPoint ) {
3282+ $ throwPoints [] = $ throwPoint ;
3283+ }
3284+ }
3285+
32823286 if ($ methodReflection !== null ) {
32833287 $ impurePoint = SimpleImpurePoint::createFromVariant ($ methodReflection , $ parametersAcceptor , $ scope , $ expr ->getArgs ());
32843288 if ($ impurePoint !== null ) {
0 commit comments