Skip to content

Commit db653c5

Browse files
committed
[experiment] skip beforeTraverse() and afterTraverse() as never used
1 parent 3fe355c commit db653c5

File tree

18 files changed

+50
-47
lines changed

18 files changed

+50
-47
lines changed

rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private function isAllowedExpr(Expr $expr, Scope $scope): bool
152152
return false;
153153
}
154154

155-
$type = $this->allAssignNodePropertyTypeInferer->inferProperty($property, $classReflection, $this->file);
155+
$type = $this->allAssignNodePropertyTypeInferer->inferProperty($property, $classReflection, $this->getFile());
156156
if (! $type instanceof Type) {
157157
return false;
158158
}

rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public function refactor(Node $node): ?Node
6868
return null;
6969
}
7070

71-
$oldTokens = $this->file->getOldTokens();
71+
$oldTokens = $this->getFile()
72+
->getOldTokens();
7273
if ($this->isIfConditionFollowedByOpeningCurlyBracket($node, $oldTokens)) {
7374
return null;
7475
}

rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function refactor(Node $node): ?NotEqual
6262
$tokenEndPos = $node->getEndTokenPos();
6363

6464
for ($i = $tokenStartPos; $i < $tokenEndPos; ++$i) {
65-
$token = $this->file->getOldTokens()[$i];
65+
$token = $this->getFile()
66+
->getOldTokens()[$i];
6667

6768
if ((string) $token === '<>') {
6869
$token->text = '!=';

rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function getNodeTypes(): array
5252
public function refactor(Node $node): ?Node
5353
{
5454
$hasVariableBeenWrapped = false;
55-
$oldTokens = $this->file->getOldTokens();
55+
$oldTokens = $this->getFile()
56+
->getOldTokens();
5657

5758
foreach ($node->parts as $index => $nodePart) {
5859
if ($nodePart instanceof Variable && $nodePart->getStartTokenPos() >= 0) {

rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ private function removeStringCast(Expr $expr): Expr
7979
}
8080

8181
$targetExpr = $expr->expr;
82-
$tokens = $this->file->getOldTokens();
82+
$tokens = $this->getFile()
83+
->getOldTokens();
8384

8485
if ($expr->expr instanceof BinaryOp) {
8586
$castStartTokenPos = $expr->getStartTokenPos();

rules/Php53/Rector/Ternary/TernaryToElvisRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public function provideMinPhpVersion(): int
7777

7878
private function isParenthesized(Expr $ifExpr, Expr $elseExpr): bool
7979
{
80-
$tokens = $this->file->getOldTokens();
80+
$tokens = $this->getFile()
81+
->getOldTokens();
8182

8283
$ifExprTokenEnd = $ifExpr->getEndTokenPos();
8384
$elseExprTokenStart = $elseExpr->getStartTokenPos();

rules/Php54/Rector/Array_/LongArrayToShortArrayRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public function refactor(Node $node): ?Node
7878

7979
$node->setAttribute(AttributeKey::KIND, Array_::KIND_SHORT);
8080

81-
$tokens = $this->file->getOldTokens();
81+
$tokens = $this->getFile()
82+
->getOldTokens();
8283

8384
$startTokenPos = $node->getStartTokenPos();
8485
$endTokenPos = $node->getEndTokenPos();

rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getNodeTypes(): array
6363
*/
6464
public function refactor(Node $node): ?Node
6565
{
66-
if (! $this->isFollowedByCurlyBracket($this->file, $node)) {
66+
if (! $this->isFollowedByCurlyBracket($this->getFile(), $node)) {
6767
return null;
6868
}
6969

rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function refactor(Node $node): ?Node
6868
return null;
6969
}
7070

71-
if ($this->parenthesizedNestedTernaryAnalyzer->isParenthesized($this->file, $node)) {
71+
if ($this->parenthesizedNestedTernaryAnalyzer->isParenthesized($this->getFile(), $node)) {
7272
return null;
7373
}
7474

rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function getNodeTypes(): array
5151
*/
5252
public function refactor(Node $node): ?Node
5353
{
54-
$oldTokens = $this->file->getOldTokens();
54+
$oldTokens = $this->getFile()
55+
->getOldTokens();
5556
$hasChanged = false;
5657

5758
foreach ($node->parts as $part) {

0 commit comments

Comments
 (0)