Skip to content

Commit

Permalink
[CodeQuality] Remove SimplifyUselessLastVariableAssignRector as overl…
Browse files Browse the repository at this point in the history
…y complex and should be handled individually (#3784)

* fixup! Make ConsecutiveNullCompareReturnsToNullCoalesceQueueRector use of StmtsAwareInterface (#3783)

* fixup! fixup! Make ConsecutiveNullCompareReturnsToNullCoalesceQueueRector use of StmtsAwareInterface (#3783)

* misc
  • Loading branch information
TomasVotruba committed May 10, 2023
1 parent 76da948 commit 11b278c
Show file tree
Hide file tree
Showing 27 changed files with 24 additions and 1,305 deletions.
32 changes: 8 additions & 24 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 414 Rules Overview
# 413 Rules Overview

<br>

## Categories

- [Arguments](#arguments) (6)

- [CodeQuality](#codequality) (78)
- [CodeQuality](#codequality) (77)

- [CodingStyle](#codingstyle) (37)

Expand Down Expand Up @@ -1343,13 +1343,16 @@ Simplify `is_array` and `empty` functions combination into a simple identical ch

### SimplifyEmptyCheckOnEmptyArrayRector

Simplify `empty` functions calls on empty arrays
Simplify `empty()` functions calls on empty arrays

- class: [`Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector`](../rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php)

```diff
-$array = []; if(empty($values))
+$array = []; if([] === $values)
$array = [];

-if (empty($values)) {
+if ([] === $values) {
}
```

<br>
Expand Down Expand Up @@ -1547,25 +1550,6 @@ Simplify tautology ternary to value

<br>

### SimplifyUselessLastVariableAssignRector

Removes the latest useless variable assigns before a variable will return.

- class: [`Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessLastVariableAssignRector`](../rules/CodeQuality/Rector/FunctionLike/SimplifyUselessLastVariableAssignRector.php)

```diff
function ($b) {
- $a = true;
if ($b === 1) {
return $b;
}
- return $a;
+ return true;
};
```

<br>

### SimplifyUselessVariableRector

Removes useless variable assigns
Expand Down
2 changes: 0 additions & 2 deletions config/set/code-quality.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
use Rector\CodeQuality\Rector\FuncCall\StrvalToTypeCastRector;
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
use Rector\CodeQuality\Rector\FunctionLike\RemoveAlwaysTrueConditionSetInConstructorRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessLastVariableAssignRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
Expand Down Expand Up @@ -194,7 +193,6 @@
InlineIsAInstanceOfRector::class,
TernaryFalseExpressionToIfRector::class,
InlineConstructorDefaultToPropertyRector::class,
SimplifyUselessLastVariableAssignRector::class,
ReturnTypeFromStrictScalarReturnExprRector::class,
TernaryEmptyArrayArrayDimFetchToCoalesceRector::class,
OptionalParametersAfterRequiredRector::class,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 11b278c

Please sign in to comment.