Skip to content

Commit 25de2cf

Browse files
committed
Add ExprAnalysisResultStorage as parameter to ExprHandler
1 parent 3500547 commit 25de2cf

12 files changed

+22
-12
lines changed

src/Analyser/Generator/ExprHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ public function supports(Expr $expr): bool;
2424
* @param T $expr
2525
* @return Generator<int, ExprAnalysisRequest|NodeCallbackRequest, ExprAnalysisResult, ExprAnalysisResult>
2626
*/
27-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator;
27+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator;
2828

2929
}

src/Analyser/Generator/ExprHandler/AssignHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPStan\Analyser\ExpressionContext;
1010
use PHPStan\Analyser\Generator\ExprAnalysisRequest;
1111
use PHPStan\Analyser\Generator\ExprAnalysisResult;
12+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1213
use PHPStan\Analyser\Generator\ExprHandler;
1314
use PHPStan\Analyser\Generator\GeneratorScope;
1415
use PHPStan\DependencyInjection\AutowiredService;
@@ -28,7 +29,7 @@ public function supports(Expr $expr): bool
2829
return $expr instanceof Assign;
2930
}
3031

31-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
32+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3233
{
3334
if (!$expr->var instanceof Expr\Variable || !is_string($expr->var->name)) {
3435
throw new ShouldNotHappenException('Not implemented');

src/Analyser/Generator/ExprHandler/CastIntHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPStan\Analyser\ExpressionContext;
1010
use PHPStan\Analyser\Generator\ExprAnalysisRequest;
1111
use PHPStan\Analyser\Generator\ExprAnalysisResult;
12+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1213
use PHPStan\Analyser\Generator\ExprHandler;
1314
use PHPStan\Analyser\Generator\GeneratorScope;
1415
use PHPStan\DependencyInjection\AutowiredService;
@@ -25,7 +26,7 @@ public function supports(Expr $expr): bool
2526
return $expr instanceof Int_;
2627
}
2728

28-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
29+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
2930
{
3031
$exprResult = yield new ExprAnalysisRequest($stmt, $expr->expr, $scope, $context->enterDeep());
3132

src/Analyser/Generator/ExprHandler/ClassConstFetchHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PhpParser\Node\Stmt;
1111
use PHPStan\Analyser\ExpressionContext;
1212
use PHPStan\Analyser\Generator\ExprAnalysisResult;
13+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1314
use PHPStan\Analyser\Generator\ExprHandler;
1415
use PHPStan\Analyser\Generator\GeneratorScope;
1516
use PHPStan\DependencyInjection\AutowiredService;
@@ -28,7 +29,7 @@ public function supports(Expr $expr): bool
2829
return $expr instanceof ClassConstFetch;
2930
}
3031

31-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
32+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3233
{
3334
if (
3435
$expr->class instanceof Name

src/Analyser/Generator/ExprHandler/ClosureHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpParser\Node\Stmt;
99
use PHPStan\Analyser\ExpressionContext;
1010
use PHPStan\Analyser\Generator\ExprAnalysisResult;
11+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1112
use PHPStan\Analyser\Generator\ExprHandler;
1213
use PHPStan\Analyser\Generator\GeneratorScope;
1314
use PHPStan\Analyser\Generator\StmtsAnalysisRequest;
@@ -27,7 +28,7 @@ public function supports(Expr $expr): bool
2728
return $expr instanceof Closure;
2829
}
2930

30-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
31+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3132
{
3233
$result = yield new StmtsAnalysisRequest($expr->stmts, $scope, StatementContext::createTopLevel()); // @phpstan-ignore generator.valueType
3334
$scope = $result->scope;

src/Analyser/Generator/ExprHandler/FuncCallHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPStan\Analyser\ExpressionContext;
1111
use PHPStan\Analyser\Generator\ExprAnalysisRequest;
1212
use PHPStan\Analyser\Generator\ExprAnalysisResult;
13+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1314
use PHPStan\Analyser\Generator\ExprHandler;
1415
use PHPStan\Analyser\Generator\GeneratorScope;
1516
use PHPStan\DependencyInjection\AutowiredService;
@@ -33,7 +34,7 @@ public function supports(Expr $expr): bool
3334
return $expr instanceof FuncCall;
3435
}
3536

36-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
37+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3738
{
3839
$throwPoints = [];
3940
$impurePoints = [];

src/Analyser/Generator/ExprHandler/MethodCallHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPStan\Analyser\ExpressionContext;
1111
use PHPStan\Analyser\Generator\ExprAnalysisRequest;
1212
use PHPStan\Analyser\Generator\ExprAnalysisResult;
13+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1314
use PHPStan\Analyser\Generator\ExprHandler;
1415
use PHPStan\Analyser\Generator\GeneratorScope;
1516
use PHPStan\DependencyInjection\AutowiredService;
@@ -28,7 +29,7 @@ public function supports(Expr $expr): bool
2829
return $expr instanceof MethodCall;
2930
}
3031

31-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
32+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3233
{
3334
if (!$expr->name instanceof Identifier) {
3435
throw new ShouldNotHappenException('Not implemented');

src/Analyser/Generator/ExprHandler/NewHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PhpParser\Node\Stmt;
1010
use PHPStan\Analyser\ExpressionContext;
1111
use PHPStan\Analyser\Generator\ExprAnalysisResult;
12+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1213
use PHPStan\Analyser\Generator\ExprHandler;
1314
use PHPStan\Analyser\Generator\GeneratorScope;
1415
use PHPStan\DependencyInjection\AutowiredService;
@@ -27,7 +28,7 @@ public function supports(Expr $expr): bool
2728
return $expr instanceof New_;
2829
}
2930

30-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
31+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
3132
{
3233
if (!$expr->class instanceof Name) {
3334
throw new ShouldNotHappenException('Not implemented');

src/Analyser/Generator/ExprHandler/ScalarIntHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpParser\Node\Stmt;
99
use PHPStan\Analyser\ExpressionContext;
1010
use PHPStan\Analyser\Generator\ExprAnalysisResult;
11+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1112
use PHPStan\Analyser\Generator\ExprHandler;
1213
use PHPStan\Analyser\Generator\GeneratorScope;
1314
use PHPStan\DependencyInjection\AutowiredService;
@@ -25,7 +26,7 @@ public function supports(Expr $expr): bool
2526
return $expr instanceof Int_;
2627
}
2728

28-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
29+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
2930
{
3031
yield from [];
3132
return new ExprAnalysisResult(

src/Analyser/Generator/ExprHandler/ScalarStringHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PhpParser\Node\Stmt;
99
use PHPStan\Analyser\ExpressionContext;
1010
use PHPStan\Analyser\Generator\ExprAnalysisResult;
11+
use PHPStan\Analyser\Generator\ExprAnalysisResultStorage;
1112
use PHPStan\Analyser\Generator\ExprHandler;
1213
use PHPStan\Analyser\Generator\GeneratorScope;
1314
use PHPStan\DependencyInjection\AutowiredService;
@@ -25,7 +26,7 @@ public function supports(Expr $expr): bool
2526
return $expr instanceof String_;
2627
}
2728

28-
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExpressionContext $context): Generator
29+
public function analyseExpr(Stmt $stmt, Expr $expr, GeneratorScope $scope, ExprAnalysisResultStorage $storage, ExpressionContext $context): Generator
2930
{
3031
yield from [];
3132
return new ExprAnalysisResult(

0 commit comments

Comments
 (0)