Skip to content

Commit

Permalink
Remove ChangeOrIfReturnToEarlyReturnRector as makes code harder to re…
Browse files Browse the repository at this point in the history
…ad by duplication, rather use PHSPtan and extract method (#3916)
  • Loading branch information
TomasVotruba committed May 22, 2023
1 parent edc60fc commit a813b17
Show file tree
Hide file tree
Showing 26 changed files with 83 additions and 777 deletions.
30 changes: 2 additions & 28 deletions build/target-repository/docs/rector_rules_overview.md
@@ -1,4 +1,4 @@
# 405 Rules Overview
# 404 Rules Overview

<br>

Expand All @@ -16,7 +16,7 @@

- [DependencyInjection](#dependencyinjection) (2)

- [EarlyReturn](#earlyreturn) (11)
- [EarlyReturn](#earlyreturn) (10)

- [MysqlToMysqli](#mysqltomysqli) (4)

Expand Down Expand Up @@ -3835,32 +3835,6 @@ Changes if || to early return

<br>

### ChangeOrIfReturnToEarlyReturnRector

Changes if || with return to early return

- class: [`Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector`](../rules/EarlyReturn/Rector/If_/ChangeOrIfReturnToEarlyReturnRector.php)

```diff
class SomeClass
{
public function run($a, $b)
{
- if ($a || $b) {
+ if ($a) {
+ return null;
+ }
+ if ($b) {
return null;
}

return 'another';
}
}
```

<br>

### PreparedValueToEarlyReturnRector

Return early prepared value in ifs
Expand Down
2 changes: 0 additions & 2 deletions config/set/early-return.php
Expand Up @@ -8,7 +8,6 @@
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
Expand All @@ -23,7 +22,6 @@
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
ReturnBinaryAndToEarlyReturnRector::class,
ChangeOrIfReturnToEarlyReturnRector::class,
ChangeOrIfContinueToMultiContinueRector::class,
PreparedValueToEarlyReturnRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a813b17

Please sign in to comment.