|
21 | 21 | use PhpParser\Node\Stmt\Static_; |
22 | 22 | use PhpParser\Node\Stmt\Switch_; |
23 | 23 | use PhpParser\NodeFinder; |
24 | | -use PHPStan\Analyser\ExprHandler\AssignHandler; |
25 | 24 | use PHPStan\Analyser\ExprHandler\Helper\NonNullabilityHelper; |
26 | | -use PHPStan\Analyser\ExprHandler\Helper\VirtualExprResultHelper; |
27 | 25 | use PHPStan\Analyser\Generics\TemplateArgumentConstraints; |
28 | 26 | use PHPStan\Analyser\Generics\TemplateArgumentFrame; |
29 | 27 | use PHPStan\Analyser\Generics\TemplateArgumentObserver; |
|
34 | 32 | use PHPStan\DependencyInjection\Container; |
35 | 33 | use PHPStan\DependencyInjection\ExtensionsCollection; |
36 | 34 | use PHPStan\File\FileHelper; |
37 | | -use PHPStan\Node\Expr\NativeTypeExpr; |
38 | | -use PHPStan\Node\Expr\TypeExpr; |
39 | 35 | use PHPStan\Node\FunctionCallableNode; |
40 | 36 | use PHPStan\Node\FunctionCallExpressionNode; |
41 | 37 | use PHPStan\Node\InstantiationCallableNode; |
@@ -1088,60 +1084,6 @@ public function callNodeCallback( |
1088 | 1084 | $nodeCallback($node, $scope->toNodeCallbackScope()); |
1089 | 1085 | } |
1090 | 1086 |
|
1091 | | - /** |
1092 | | - * @param callable(Node $node, Scope $scope): void $nodeCallback |
1093 | | - */ |
1094 | | - public function processVirtualAssign(MutatingScope $scope, ExpressionResultStorage $storage, Node\Stmt $stmt, Expr $var, Expr $assignedExpr, callable $nodeCallback, ?ExpressionResult $assignedExprResult = null): ExpressionResult |
1095 | | - { |
1096 | | - // work off an available result for the assigned expr: passed by the |
1097 | | - // caller, or fabricated from a type-carrying virtual node - threaded |
1098 | | - // straight into applyWrite() so its reads compose instead of falling |
1099 | | - // back to on-demand pricing of the type, the truthy/falsey narrowing, |
1100 | | - // and the synthetic sentinel comparisons |
1101 | | - if ( |
1102 | | - $assignedExprResult === null |
1103 | | - && ($assignedExpr instanceof TypeExpr || $assignedExpr instanceof NativeTypeExpr) |
1104 | | - && $storage->findExpressionResult($assignedExpr) === null |
1105 | | - ) { |
1106 | | - $assignedExprResult = $this->container->getByType(VirtualExprResultHelper::class)->createTypeExprResult($scope, $assignedExpr); |
1107 | | - } |
1108 | | - |
1109 | | - $assignHandler = $this->container->getByType(AssignHandler::class); |
1110 | | - $virtualAssignNodeCallback = VirtualAssignNodeCallback::create($nodeCallback); |
1111 | | - $target = $assignHandler->prepareTarget( |
1112 | | - $this, |
1113 | | - $scope, |
1114 | | - $storage, |
1115 | | - $stmt, |
1116 | | - $var, |
1117 | | - $assignedExpr, |
1118 | | - $virtualAssignNodeCallback, |
1119 | | - ExpressionContext::createDeep(), |
1120 | | - AssignTargetWalkMode::virtualAssign(), |
1121 | | - ); |
1122 | | - |
1123 | | - return $assignHandler->applyWrite( |
1124 | | - $this, |
1125 | | - $target, |
1126 | | - $this->expressionResultFactory->create( |
1127 | | - $target->getScope(), |
1128 | | - beforeScope: $target->getScope(), |
1129 | | - expr: $assignedExpr, |
1130 | | - hasYield: false, |
1131 | | - isAlwaysTerminating: false, |
1132 | | - throwPoints: [], |
1133 | | - impurePoints: [], |
1134 | | - typeCallback: static fn () => new MixedType(), |
1135 | | - specifyTypesCallback: SpecifiedTypes::emptySpecifyCallback(), |
1136 | | - ), |
1137 | | - $assignedExprResult, |
1138 | | - $stmt, |
1139 | | - $storage, |
1140 | | - $virtualAssignNodeCallback, |
1141 | | - ExpressionContext::createDeep(), |
1142 | | - ); |
1143 | | - } |
1144 | | - |
1145 | 1087 | /** |
1146 | 1088 | * The template argument frame of the body being walked while it observes |
1147 | 1089 | * a body that created unresolved template arguments - null otherwise, so |
|
0 commit comments