Skip to content

Commit 1790dab

Browse files
committed
Fixes
1 parent 13c634e commit 1790dab

12 files changed

+21
-21
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ private function processStmtNode(
425425
$nodeCallback($declare->value, $scope);
426426
if (
427427
$declare->key->name !== 'strict_types'
428-
|| !($declare->value instanceof Node\Scalar\LNumber)
428+
|| !($declare->value instanceof Node\Scalar\Int_)
429429
|| $declare->value->value !== 1
430430
) {
431431
continue;
@@ -4115,7 +4115,7 @@ static function (): void {
41154115
$throwPoints = array_merge($throwPoints, $valueResult->getThrowPoints());
41164116

41174117
if ($arrayItem->key === null) {
4118-
$dimExpr = new Node\Scalar\LNumber($i);
4118+
$dimExpr = new Node\Scalar\Int_($i);
41194119
} else {
41204120
$dimExpr = $arrayItem->key;
41214121
}

src/Analyser/StatementResult.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPStan\Analyser;
44

5-
use PhpParser\Node\Scalar\LNumber;
5+
use PhpParser\Node\Scalar\Int_;
66
use PhpParser\Node\Stmt;
77

88
/** @api */
@@ -51,7 +51,7 @@ public function filterOutLoopExitPoints(): self
5151
}
5252

5353
$num = $statement->num;
54-
if (!$num instanceof LNumber) {
54+
if (!$num instanceof Int_) {
5555
return new self($this->scope, $this->hasYield, false, $this->exitPoints, $this->throwPoints);
5656
}
5757

@@ -92,7 +92,7 @@ public function getExitPointsByType(string $stmtClass): array
9292
continue;
9393
}
9494

95-
if (!$value instanceof LNumber) {
95+
if (!$value instanceof Int_) {
9696
$exitPoints[] = $exitPoint;
9797
continue;
9898
}
@@ -123,7 +123,7 @@ public function getExitPointsForOuterLoop(): array
123123
if ($statement->num === null) {
124124
continue;
125125
}
126-
if (!$statement->num instanceof LNumber) {
126+
if (!$statement->num instanceof Int_) {
127127
continue;
128128
}
129129
$value = $statement->num->value;
@@ -133,7 +133,7 @@ public function getExitPointsForOuterLoop(): array
133133

134134
$newNode = null;
135135
if ($value > 2) {
136-
$newNode = new LNumber($value - 1);
136+
$newNode = new Int_($value - 1);
137137
}
138138
if ($statement instanceof Stmt\Continue_) {
139139
$newStatement = new Stmt\Continue_($newNode);

src/Parser/RemoveUnusedCodeByPhpVersionIdVisitor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ public function enterNode(Node $node): Node|int|null
7777
private function getOperands(Node\Expr $left, Node\Expr $right): ?array
7878
{
7979
if (
80-
$left instanceof Node\Scalar\LNumber
80+
$left instanceof Node\Scalar\Int_
8181
&& $right instanceof Node\Expr\ConstFetch
8282
&& $right->name->toString() === 'PHP_VERSION_ID'
8383
) {
8484
return [(new PhpVersion($left->value))->getVersionString(), $this->phpVersionString];
8585
}
8686

8787
if (
88-
$right instanceof Node\Scalar\LNumber
88+
$right instanceof Node\Scalar\Int_
8989
&& $left instanceof Node\Expr\ConstFetch
9090
&& $left->name->toString() === 'PHP_VERSION_ID'
9191
) {

src/Reflection/InitializerExprTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ public function getUnaryMinusType(Expr $expr, callable $getTypeCallback): Type
19881988
}
19891989

19901990
if ($type instanceof IntegerRangeType) {
1991-
return $getTypeCallback(new Expr\BinaryOp\Mul($expr, new LNumber(-1)));
1991+
return $getTypeCallback(new Expr\BinaryOp\Mul($expr, new Int_(-1)));
19921992
}
19931993

19941994
return $type;

src/Rules/Arrays/ArrayDestructuringRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function getErrors(Scope $scope, Node\Expr\List_ $var, Expr $expr): arra
8585
$keyExpr = null;
8686
if ($item->key === null) {
8787
$keyType = new ConstantIntegerType($i);
88-
$keyExpr = new Node\Scalar\LNumber($i);
88+
$keyExpr = new Node\Scalar\Int_($i);
8989
} else {
9090
$keyType = $scope->getType($item->key);
9191
$keyExpr = new TypeExpr($keyType);

src/Rules/Classes/EnumSanityRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function processNode(Node $node, Scope $scope): array
156156
}
157157
$caseName = $stmt->name->name;
158158

159-
if ($stmt->expr instanceof Node\Scalar\LNumber || $stmt->expr instanceof Node\Scalar\String_) {
159+
if ($stmt->expr instanceof Node\Scalar\Int_ || $stmt->expr instanceof Node\Scalar\String_) {
160160
if ($enumNode->scalarType === null) {
161161
$errors[] = RuleErrorBuilder::message(sprintf(
162162
'Enum %s is not backed, but case %s has value %s.',

src/Rules/Comparison/DoWhileLoopConstantConditionRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPStan\Rules\Comparison;
44

55
use PhpParser\Node;
6-
use PhpParser\Node\Scalar\LNumber;
6+
use PhpParser\Node\Scalar\Int_;
77
use PhpParser\Node\Stmt\Break_;
88
use PhpParser\Node\Stmt\Continue_;
99
use PHPStan\Analyser\Scope;
@@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4747
if ($statement->num === null) {
4848
continue;
4949
}
50-
if (!$statement->num instanceof LNumber) {
50+
if (!$statement->num instanceof Int_) {
5151
continue;
5252
}
5353
$value = $statement->num->value;

src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace PHPStan\Rules\Comparison;
44

55
use PhpParser\Node;
6-
use PhpParser\Node\Scalar\LNumber;
6+
use PhpParser\Node\Scalar\Int_;
77
use PhpParser\Node\Stmt\Break_;
88
use PhpParser\Node\Stmt\Continue_;
99
use PHPStan\Analyser\Scope;
@@ -46,7 +46,7 @@ public function processNode(
4646
if ($statement->num === null) {
4747
continue;
4848
}
49-
if (!$statement->num instanceof LNumber) {
49+
if (!$statement->num instanceof Int_) {
5050
continue;
5151
}
5252
$value = $statement->num->value;

src/Rules/Keywords/ContinueBreakInLoopRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function processNode(Node $node, Scope $scope): array
2828
return [];
2929
}
3030

31-
if (!$node->num instanceof Node\Scalar\LNumber) {
31+
if (!$node->num instanceof Node\Scalar\Int_) {
3232
$value = 1;
3333
} else {
3434
$value = $node->num->value;

src/Rules/Keywords/DeclareStrictTypesRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function processNode(Node $node, Scope $scope): array
4040
}
4141

4242
if (
43-
!$declare->value instanceof Node\Scalar\LNumber
43+
!$declare->value instanceof Node\Scalar\Int_
4444
|| !in_array($declare->value->value, [0, 1], true)
4545
) {
4646
return [

0 commit comments

Comments
 (0)