Skip to content

Commit c761f9b

Browse files
committed
Fixes
1 parent 48f3644 commit c761f9b

File tree

8 files changed

+13
-19
lines changed

8 files changed

+13
-19
lines changed

src/Analyser/MutatingScope.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
use PhpParser\Node\InterpolatedStringPart;
2525
use PhpParser\Node\Name;
2626
use PhpParser\Node\Name\FullyQualified;
27-
use PhpParser\Node\Scalar\DNumber;
28-
use PhpParser\Node\Scalar\LNumber;
2927
use PhpParser\Node\Scalar\String_;
3028
use PhpParser\NodeFinder;
3129
use PHPStan\Node\ExecutionEndNode;
@@ -1082,7 +1080,7 @@ private function resolveType(string $exprString, Expr $node): Type
10821080
return $this->getType($node->expr);
10831081
}
10841082

1085-
if ($node instanceof LNumber) {
1083+
if ($node instanceof Node\Scalar\Int_) {
10861084
return $this->initializerExprTypeResolver->getType($node, InitializerExprContext::fromScope($this));
10871085
} elseif ($node instanceof String_) {
10881086
return $this->initializerExprTypeResolver->getType($node, InitializerExprContext::fromScope($this));
@@ -1106,7 +1104,7 @@ private function resolveType(string $exprString, Expr $node): Type
11061104
}
11071105

11081106
return $resultType ?? new ConstantStringType('');
1109-
} elseif ($node instanceof DNumber) {
1107+
} elseif ($node instanceof Node\Scalar\Float_) {
11101108
return $this->initializerExprTypeResolver->getType($node, InitializerExprContext::fromScope($this));
11111109
} elseif ($node instanceof Expr\CallLike && $node->isFirstClassCallable()) {
11121110
if ($node instanceof FuncCall) {
@@ -1466,10 +1464,10 @@ private function resolveType(string $exprString, Expr $node): Type
14661464
}
14671465

14681466
if ($node instanceof Expr\PreInc) {
1469-
return $this->getType(new BinaryOp\Plus($node->var, new LNumber(1)));
1467+
return $this->getType(new BinaryOp\Plus($node->var, new Node\Scalar\Int_(1)));
14701468
}
14711469

1472-
return $this->getType(new BinaryOp\Minus($node->var, new LNumber(1)));
1470+
return $this->getType(new BinaryOp\Minus($node->var, new Node\Scalar\Int_(1)));
14731471
} elseif ($node instanceof Expr\Yield_) {
14741472
$functionReflection = $this->getFunction();
14751473
if ($functionReflection === null) {

src/Analyser/NodeScopeResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ private function processStmtNode(
376376
&& !$stmt instanceof Foreach_
377377
&& !$stmt instanceof Node\Stmt\Global_
378378
&& !$stmt instanceof Node\Stmt\Property
379-
&& !$stmt instanceof Node\Stmt\PropertyProperty
380379
&& !$stmt instanceof Node\Stmt\ClassConst
381380
&& !$stmt instanceof Node\Stmt\Const_
382381
) {

src/Dependency/ExportedNodeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private function exportClassStatement(Node\Stmt $node, string $fileName, string
336336
$docComment = $node->getDocComment();
337337

338338
return new ExportedPropertiesNode(
339-
array_map(static fn (Node\Stmt\PropertyProperty $prop): string => $prop->name->toString(), $node->props),
339+
array_map(static fn (Node\PropertyItem $prop): string => $prop->name->toString(), $node->props),
340340
$this->exportPhpDocNode(
341341
$fileName,
342342
$namespacedName,

src/Reflection/InitializerExprTypeResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use PhpParser\Node\Expr\PropertyFetch;
1111
use PhpParser\Node\Identifier;
1212
use PhpParser\Node\Name;
13-
use PhpParser\Node\Scalar\DNumber;
14-
use PhpParser\Node\Scalar\LNumber;
13+
use PhpParser\Node\Scalar\Float_;
14+
use PhpParser\Node\Scalar\Int_;
1515
use PhpParser\Node\Scalar\MagicConst;
1616
use PhpParser\Node\Scalar\MagicConst\Dir;
1717
use PhpParser\Node\Scalar\MagicConst\File;
@@ -109,10 +109,10 @@ public function getType(Expr $expr, InitializerExprContext $context): Type
109109
if ($expr instanceof TypeExpr) {
110110
return $expr->getExprType();
111111
}
112-
if ($expr instanceof LNumber) {
112+
if ($expr instanceof Int_) {
113113
return new ConstantIntegerType($expr->value);
114114
}
115-
if ($expr instanceof DNumber) {
115+
if ($expr instanceof Float_) {
116116
return new ConstantFloatType($expr->value);
117117
}
118118
if ($expr instanceof String_) {

src/Rules/Namespaces/ExistingNamesInUseRule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function processNode(Node $node, Scope $scope): array
5858
}
5959

6060
/**
61-
* @param Node\Stmt\UseUse[] $uses
61+
* @param Node\UseItem[] $uses
6262
* @return list<IdentifierRuleError>
6363
*/
6464
private function checkConstants(array $uses): array
@@ -80,7 +80,7 @@ private function checkConstants(array $uses): array
8080
}
8181

8282
/**
83-
* @param Node\Stmt\UseUse[] $uses
83+
* @param Node\UseItem[] $uses
8484
* @return list<IdentifierRuleError>
8585
*/
8686
private function checkFunctions(array $uses): array
@@ -117,13 +117,13 @@ private function checkFunctions(array $uses): array
117117
}
118118

119119
/**
120-
* @param Node\Stmt\UseUse[] $uses
120+
* @param Node\UseItem[] $uses
121121
* @return list<IdentifierRuleError>
122122
*/
123123
private function checkClasses(array $uses): array
124124
{
125125
return $this->classCaseSensitivityCheck->checkClassNames(
126-
array_map(static fn (Node\Stmt\UseUse $use): ClassNameNodePair => new ClassNameNodePair((string) $use->name, $use->name), $uses),
126+
array_map(static fn (Node\UseItem $use): ClassNameNodePair => new ClassNameNodePair((string) $use->name, $use->name), $uses),
127127
);
128128
}
129129

src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function processNode(Node $node, Scope $scope): array
4848
{
4949
if (
5050
$node instanceof Node\Stmt\Property
51-
|| $node instanceof Node\Stmt\PropertyProperty
5251
|| $node instanceof Node\Stmt\ClassConst
5352
|| $node instanceof Node\Stmt\Const_
5453
) {

src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function processNode(Node $node, Scope $scope): array
5151
{
5252
if (
5353
$node instanceof Node\Stmt\Property
54-
|| $node instanceof Node\Stmt\PropertyProperty
5554
|| $node instanceof Node\Stmt\ClassConst
5655
|| $node instanceof Node\Stmt\Const_
5756
|| ($node instanceof VirtualNode && !$node instanceof InFunctionNode && !$node instanceof InClassMethodNode && !$node instanceof InClassNode)

src/Type/FileTypeMapper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ function (Node $node) use ($fileName, $lookForTrait, $phpDocNodeMap, &$traitFoun
516516
&& !$node instanceof Node\Stmt\Namespace_
517517
&& !$node instanceof Node\Stmt\Declare_
518518
&& !$node instanceof Node\Stmt\Use_
519-
&& !$node instanceof Node\Stmt\UseUse
520519
&& !$node instanceof Node\Stmt\GroupUse
521520
&& !$node instanceof Node\Stmt\TraitUse
522521
&& !$node instanceof Node\Stmt\TraitUseAdaptation

0 commit comments

Comments
 (0)