Skip to content

Commit 9c17795

Browse files
committed
Fixes
1 parent 2306023 commit 9c17795

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
@@ -494,7 +494,7 @@ private function processStmtNode(
494494
$nodeCallback($declare->value, $scope);
495495
if (
496496
$declare->key->name !== 'strict_types'
497-
|| !($declare->value instanceof Node\Scalar\LNumber)
497+
|| !($declare->value instanceof Node\Scalar\Int_)
498498
|| $declare->value->value !== 1
499499
) {
500500
continue;
@@ -5298,7 +5298,7 @@ static function (): void {
52985298
$impurePoints = array_merge($impurePoints, $valueResult->getImpurePoints());
52995299

53005300
if ($arrayItem->key === null) {
5301-
$dimExpr = new Node\Scalar\LNumber($i);
5301+
$dimExpr = new Node\Scalar\Int_($i);
53025302
} else {
53035303
$dimExpr = $arrayItem->key;
53045304
}

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
/**
@@ -58,7 +58,7 @@ public function filterOutLoopExitPoints(): self
5858
}
5959

6060
$num = $statement->num;
61-
if (!$num instanceof LNumber) {
61+
if (!$num instanceof Int_) {
6262
return new self($this->scope, $this->hasYield, false, $this->exitPoints, $this->throwPoints, $this->impurePoints);
6363
}
6464

@@ -99,7 +99,7 @@ public function getExitPointsByType(string $stmtClass): array
9999
continue;
100100
}
101101

102-
if (!$value instanceof LNumber) {
102+
if (!$value instanceof Int_) {
103103
$exitPoints[] = $exitPoint;
104104
continue;
105105
}
@@ -130,7 +130,7 @@ public function getExitPointsForOuterLoop(): array
130130
if ($statement->num === null) {
131131
continue;
132132
}
133-
if (!$statement->num instanceof LNumber) {
133+
if (!$statement->num instanceof Int_) {
134134
continue;
135135
}
136136
$value = $statement->num->value;
@@ -140,7 +140,7 @@ public function getExitPointsForOuterLoop(): array
140140

141141
$newNode = null;
142142
if ($value > 2) {
143-
$newNode = new LNumber($value - 1);
143+
$newNode = new Int_($value - 1);
144144
}
145145
if ($statement instanceof Stmt\Continue_) {
146146
$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
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
@@ -2044,7 +2044,7 @@ public function getUnaryMinusType(Expr $expr, callable $getTypeCallback): Type
20442044
}
20452045

20462046
if ($type instanceof IntegerRangeType) {
2047-
return $getTypeCallback(new Expr\BinaryOp\Mul($expr, new LNumber(-1)));
2047+
return $getTypeCallback(new Expr\BinaryOp\Mul($expr, new Int_(-1)));
20482048
}
20492049

20502050
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
@@ -143,7 +143,7 @@ public function processNode(Node $node, Scope $scope): array
143143
}
144144
$caseName = $stmt->name->name;
145145

146-
if ($stmt->expr instanceof Node\Scalar\LNumber || $stmt->expr instanceof Node\Scalar\String_) {
146+
if ($stmt->expr instanceof Node\Scalar\Int_ || $stmt->expr instanceof Node\Scalar\String_) {
147147
if ($enumNode->scalarType === null) {
148148
$errors[] = RuleErrorBuilder::message(sprintf(
149149
'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)