Skip to content

Commit cd5a6f6

Browse files
committed
Finalize resolveType on ExprHandler
1 parent 19faea6 commit cd5a6f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6
-161
lines changed

src/Analyser/ExprHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpParser\Node;
66
use PhpParser\Node\Expr;
77
use PhpParser\Node\Stmt;
8+
use PHPStan\Type\Type;
89

910
/**
1011
* @template T of Expr
@@ -31,4 +32,9 @@ public function processExpr(
3132
ExpressionContext $context,
3233
): ExpressionResult;
3334

35+
/**
36+
* @param T $expr
37+
*/
38+
public function resolveType(MutatingScope $scope, Expr $expr): Type;
39+
3440
}

src/Analyser/ExprHandler/ArrayDimFetchHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public function supports(Expr $expr): bool
3535
return $expr instanceof ArrayDimFetch;
3636
}
3737

38-
/**
39-
* @param ArrayDimFetch $expr
40-
*/
4138
public function resolveType(MutatingScope $scope, Expr $expr): Type
4239
{
4340
if ($expr->dim === null) {

src/Analyser/ExprHandler/ArrayHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ public function supports(Expr $expr): bool
3636
return $expr instanceof Array_;
3737
}
3838

39-
/**
40-
* @param Array_ $expr
41-
*/
4239
public function resolveType(MutatingScope $scope, Expr $expr): Type
4340
{
4441
return $this->initializerExprTypeResolver->getArrayType($expr, static fn (Expr $expr): Type => $scope->getType($expr));

src/Analyser/ExprHandler/ArrowFunctionHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4646
);
4747
}
4848

49-
/**
50-
* @param ArrowFunction $expr
51-
*/
5249
public function resolveType(MutatingScope $scope, Expr $expr): Type
5350
{
5451
return $this->closureTypeResolver->getClosureType($scope, $expr);

src/Analyser/ExprHandler/AssignHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ public function supports(Expr $expr): bool
8888
return $expr instanceof Assign || $expr instanceof AssignRef;
8989
}
9090

91-
/**
92-
* @param Assign|AssignRef $expr
93-
*/
9491
public function resolveType(MutatingScope $scope, Expr $expr): Type
9592
{
9693
return $scope->getType($expr->expr);

src/Analyser/ExprHandler/AssignOpHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ static function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $contex
102102
);
103103
}
104104

105-
/**
106-
* @param AssignOp $expr
107-
*/
108105
public function resolveType(MutatingScope $scope, Expr $expr): Type
109106
{
110107
$getType = static fn (Expr $expr): Type => $scope->getType($expr);

src/Analyser/ExprHandler/BinaryOpHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
8989
);
9090
}
9191

92-
/**
93-
* @param BinaryOp $expr
94-
*/
9592
public function resolveType(MutatingScope $scope, Expr $expr): Type
9693
{
9794
$getType = static fn (Expr $expr): Type => $scope->getType($expr);

src/Analyser/ExprHandler/BitwiseNotHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4949
);
5050
}
5151

52-
/**
53-
* @param BitwiseNot $expr
54-
*/
5552
public function resolveType(MutatingScope $scope, Expr $expr): Type
5653
{
5754
return $this->initializerExprTypeResolver->getBitwiseNotType($expr->expr, static fn (Expr $expr): Type => $scope->getType($expr));

src/Analyser/ExprHandler/BooleanAndHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public function supports(Expr $expr): bool
4343
return $expr instanceof BooleanAnd || $expr instanceof LogicalAnd;
4444
}
4545

46-
/**
47-
* @param BooleanAnd|LogicalAnd $expr
48-
*/
4946
public function resolveType(MutatingScope $scope, Expr $expr): Type
5047
{
5148
$leftBooleanType = $scope->getType($expr->left)->toBoolean();

src/Analyser/ExprHandler/BooleanNotHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
4444
);
4545
}
4646

47-
/**
48-
* @param BooleanNot $expr
49-
*/
5047
public function resolveType(MutatingScope $scope, Expr $expr): Type
5148
{
5249
$exprBooleanType = $scope->getType($expr->expr)->toBoolean();

0 commit comments

Comments
 (0)