Skip to content

Commit dcfe579

Browse files
committed
[experiment] skip beforeTraverse() and afterTraverse() as never used
1 parent 95eeca2 commit dcfe579

File tree

17 files changed

+122
-43
lines changed

17 files changed

+122
-43
lines changed

generated-release-notes.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## New Features :partying_face:
2+
3+
* [compat] Add SymplifyQuoteEscapeRector deprecated rule for BC layer ([#7744](https://github.com/rectorphp/rector-src/pull/7744))
4+
* Add PrivatizeFinalClassConstantRector ([#7753](https://github.com/rectorphp/rector-src/pull/7753)), Thanks @simonschaufi!
5+
* Fix fixture class name under AddTypeToConstRector ([#7754](https://github.com/rectorphp/rector-src/pull/7754))
6+
* [dead-code] Add RemoveParentDelegatingConstructorRector ([#7769](https://github.com/rectorphp/rector-src/pull/7769))
7+
* Manage named arguments in ArgumentAdderRector rule ([#7777](https://github.com/rectorphp/rector-src/pull/7777)), Thanks @carlos-granados!
8+
9+
<br>
10+
11+
## Bugfixes :bug:
12+
13+
* [Php81] Skip on Param default on ArrayToFirstClassCallableRector ([#7749](https://github.com/rectorphp/rector-src/pull/7749))
14+
* [CodeQuality] Handle ternary in identical left/right on UseIdenticalOverEqualWithSameTypeRector ([#7748](https://github.com/rectorphp/rector-src/pull/7748))
15+
* fix: chained calls on static calls ([#7746](https://github.com/rectorphp/rector-src/pull/7746)), Thanks @calebdw!
16+
* [code-quality] Extract standalone SortAttributeNamedArgsRector from SortNamedParamRector, to slightly different areas ([#7750](https://github.com/rectorphp/rector-src/pull/7750))
17+
* [rename] Rename SortNamedParamRector to SortCallLikeNamedArgsRector to be more clear about the intent ([#7751](https://github.com/rectorphp/rector-src/pull/7751))
18+
* [Php85] Skip under unset() on ArrayFirstLastRector ([#7752](https://github.com/rectorphp/rector-src/pull/7752))
19+
* Rectify ([#7755](https://github.com/rectorphp/rector-src/pull/7755))
20+
* Fix crash ->getComments() return must be array over true on ClosureToArrowFunctionRector ([#7761](https://github.com/rectorphp/rector-src/pull/7761))
21+
* [Php81] ArrayToFirstClassCallableRector should not skip non-public methods from owning scope ([#7760](https://github.com/rectorphp/rector-src/pull/7760)), Thanks @acoulton!
22+
* [fix] wrap ternary in parenthese on string casting, if only cond is casted ([#7745](https://github.com/rectorphp/rector-src/pull/7745))
23+
* [internal] Fix inline replace block removal not removed on deep block for InlineIfToExplicitIfRector + ReplaceBlockToItsStmtsRector ([#7764](https://github.com/rectorphp/rector-src/pull/7764))
24+
* [internal] Make consistent to continue outer loop when subnode type changed on AbstractImmutableNodeTraverser ([#7766](https://github.com/rectorphp/rector-src/pull/7766))
25+
* Introduce FileNode to handle file-level changes ([#7728](https://github.com/rectorphp/rector-src/pull/7728))
26+
* Fix rector-symfony phpunit ([#7772](https://github.com/rectorphp/rector-src/pull/7772))
27+
* [TypeDeclaration] Skip class not found on ObjectTypedPropertyFromJMSSerializerAttributeTypeRector ([#7774](https://github.com/rectorphp/rector-src/pull/7774))
28+
* [Php85] Skip defined int or string on ArrayKeyExistsNullToEmptyStringRector ([#7758](https://github.com/rectorphp/rector-src/pull/7758))
29+
30+
<br>
31+
32+
## Removed :skull:
33+
34+
* [DeadCode] Skip trait on RemoveAlwaysTrueIfConditionRector ([#7759](https://github.com/rectorphp/rector-src/pull/7759))
35+
* [internal] Remove duplicated enterNode() type check already handled in node traverser ([#7717](https://github.com/rectorphp/rector-src/pull/7717))
36+
* [dx] warn about deprecated beforeTraverse() method once FileNode is ready ([#7768](https://github.com/rectorphp/rector-src/pull/7768))
37+
* [DeadCode] Skip next assign expr has side effect inside try {} on RemoveDoubleAssignRector ([#7775](https://github.com/rectorphp/rector-src/pull/7775))
38+
* [DeadCode] Skip with different default param value child vs parent on RemoveParentDelegatingConstructorRector ([#7776](https://github.com/rectorphp/rector-src/pull/7776))
39+
40+
41+
## rectorphp/rector-symfony
42+
43+
* bump ([#911](https://github.com/rectorphp/rector-symfony/pull/911))
44+
* [code-quality] Add ReturnDirectJsonResponseRector ([#910](https://github.com/rectorphp/rector-symfony/pull/910))
45+
* Fix scoped downgrade SymfonyClass ([#909](https://github.com/rectorphp/rector-symfony/pull/909))
46+
* cover is safe ([#908](https://github.com/rectorphp/rector-symfony/pull/908))
47+
* [twig] add explicit attribute name arg, to improve context ([#907](https://github.com/rectorphp/rector-symfony/pull/907))
48+
* [Symfony73] Fix named arg different position crash on InvokableCommandInputAttributeRector ([#905](https://github.com/rectorphp/rector-symfony/pull/905))
49+
* [CodeQuality] Skip UserInterface instance on ControllerMethodInjectionToConstructorRector ([#904](https://github.com/rectorphp/rector-symfony/pull/904))
50+
* create ClassMethod directly in InvokableCommandInputAttributeRector, to keep newline per attribute ([#903](https://github.com/rectorphp/rector-symfony/pull/903))
51+
* Remove InvokableCommandInputAttributeRector from set ([#901](https://github.com/rectorphp/rector-symfony/pull/901))
52+
* [Validator] use constants for Email ([#900](https://github.com/rectorphp/rector-symfony/pull/900)), Thanks @JohJohan
53+
54+
55+
56+
## rectorphp/rector-doctrine
57+
58+
* Make use of `FileNode` ([#474](https://github.com/rectorphp/rector-doctrine/pull/474))
59+
60+
61+
62+
## rectorphp/rector-phpunit
63+
64+
* [AnnotationsToAttributes] Handle both annotation and attributes exists on DataProviderAnnotationToAttributeRector ([#603](https://github.com/rectorphp/rector-phpunit/pull/603))
65+
* [fix] skip AddInstanceofAssertForNullableArgumentRector on assert call ([#602](https://github.com/rectorphp/rector-phpunit/pull/602))
66+
* [code-quality] Add AddInstanceofAssertForNullableArgumentRector ([#601](https://github.com/rectorphp/rector-phpunit/pull/601))
67+
* use FileNode in DeclareStrictTypesTestsRector ([#599](https://github.com/rectorphp/rector-phpunit/pull/599))
68+

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/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)