Skip to content

Commit c2251bd

Browse files
Make compatible with PHPStan 2.1.x-dev for ObjectType::equals() change behaviour (#7956)
* Test PHPStan 2.1.x-dev for ObjectType::equals() change behaviour * Fix on RenameClassRectorTest * Fix on NonExistingObjectType * Fix on ShortenedObjectType * [ci-review] Rector Rectify * fix phpstan * [ci-review] Rector Rectify * Fix phpstan * rollback phpstan dependency --------- Co-authored-by: GitHub Action <actions@github.com>
1 parent 9c1e5a2 commit c2251bd

29 files changed

+56
-40
lines changed

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,5 @@ parameters:
475475
-
476476
message: '#Unable to resolve the template type T in call to static method Webmozart\\Assert\\Assert\:\:isInstanceOfAny\(\)#'
477477
path: rules/DeadCode/Rector/FunctionLike/NarrowWideUnionReturnTypeRector.php
478+
479+
- '#Provide more specific return type "Iterator|PhpParser\\Node" over abstract one#'

rules/CodeQuality/Rector/Assign/CombinedAssignRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public function refactor(Node $node): ?Node
4949
return null;
5050
}
5151

52-
/** @var BinaryOp $binaryNode */
5352
$binaryNode = $node->expr;
5453

5554
if (! $this->nodeComparator->areNodesEqual($node->var, $binaryNode->left)) {

rules/CodeQuality/Rector/FuncCall/SimplifyFuncGetArgsCountRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function refactor(Node $node): ?Node
5050
return null;
5151
}
5252

53-
/** @var FuncCall $innerFuncCall */
5453
$innerFuncCall = $firstArg->value;
5554

5655
if (! $this->isName($innerFuncCall, 'func_get_args')) {

rules/CodeQuality/Rector/FuncCall/SimplifyInArrayValuesRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public function refactor(Node $node): ?Node
5757
return null;
5858
}
5959

60-
/** @var FuncCall $innerFunCall */
6160
$innerFunCall = $node->args[1]->value;
6261
if (! $this->isName($innerFunCall, 'array_values')) {
6362
return null;

rules/CodeQuality/Rector/FuncCall/SimplifyStrposLowerRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public function refactor(Node $node): ?Node
6262
return null;
6363
}
6464

65-
/** @var FuncCall $innerFuncCall */
6665
$innerFuncCall = $firstArg->value;
6766
if (! $this->isName($innerFuncCall, 'strtolower')) {
6867
return null;

rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ private function resolveArrayItem(FuncCall $funcCall): ?ArrayItem
113113
return null;
114114
}
115115

116-
/** @var Array_ $arrayNode */
117116
$arrayNode = $funcCall->args[1]->value;
118117
if (count($arrayNode->items) !== 1) {
119118
return null;

rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ private function resolveIdentical(Expr $expr, bool $isNegated, String_ $string):
235235
{
236236
/**
237237
* // compare === ''
238-
*
239-
* @var Identical|NotIdentical
240238
*/
241239
$identical = $isNegated
242240
? new Identical($expr, $string)

rules/DeadCode/Rector/ClassMethod/RemoveUselessAssignFromPropertyPromotionRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public function refactor(Node $node): ?Node
9797
return null;
9898
}
9999

100-
/** @var Assign $assign */
101100
$assign = $stmt->expr;
102101

103102
// has non property fetches assignments, skip

rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
use PhpParser\Comment\Doc;
88
use PhpParser\Node;
9-
use PhpParser\Node\Expr\PropertyFetch;
10-
use PhpParser\Node\Expr\StaticPropertyFetch;
119
use PhpParser\Node\Stmt\Expression;
1210
use PhpParser\Node\Stmt\Nop;
1311
use PhpParser\NodeVisitor;
@@ -93,7 +91,6 @@ private function hasGetMagic(Expression $expression): bool
9391
return false;
9492
}
9593

96-
/** @var PropertyFetch|StaticPropertyFetch $propertyFetch */
9794
$propertyFetch = $expression->expr;
9895
$phpPropertyReflection = $this->reflectionResolver->resolvePropertyReflectionFromPropertyFetch($propertyFetch);
9996

rules/DeadCode/UselessIfCondBeforeForeachDetector.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function isMatchingEmptyAndForeachedExpr(If_ $if, Expr $foreachExpr): boo
3232
return false;
3333
}
3434

35-
/** @var Empty_ $empty */
3635
$empty = $if->cond;
3736

3837
if (! $this->nodeComparator->areNodesEqual($empty->expr, $foreachExpr)) {
@@ -66,7 +65,6 @@ public function isMatchingNotEmpty(If_ $if, Expr $foreachExpr, Scope $scope): bo
6665
return false;
6766
}
6867

69-
/** @var Empty_ $empty */
7068
$empty = $cond->expr;
7169

7270
return $this->areCondExprAndForeachExprSame($empty, $foreachExpr, $scope);
@@ -85,7 +83,6 @@ public function isMatchingNotIdenticalEmptyArray(If_ $if, Expr $foreachExpr): bo
8583
return false;
8684
}
8785

88-
/** @var NotIdentical|NotEqual $notIdentical */
8986
$notIdentical = $if->cond;
9087

9188
return $this->isMatchingNotBinaryOp($notIdentical, $foreachExpr);

0 commit comments

Comments
 (0)