Skip to content

Commit

Permalink
[CodeQuality] Remove SimplifyIfIssetToNullCoalescingRector, as overly…
Browse files Browse the repository at this point in the history
… complex and should be handled by manual context (#2828)
  • Loading branch information
TomasVotruba committed Aug 24, 2022
1 parent 6306f9e commit 9018492
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 299 deletions.
27 changes: 2 additions & 25 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 411 Rules Overview
# 410 Rules Overview

<br>

## Categories

- [Arguments](#arguments) (5)

- [CodeQuality](#codequality) (73)
- [CodeQuality](#codequality) (72)

- [CodingStyle](#codingstyle) (36)

Expand Down Expand Up @@ -1326,29 +1326,6 @@ Changes compared to value and return of expr to direct return

<br>

### SimplifyIfIssetToNullCoalescingRector

Simplify binary if to null coalesce

- class: [`Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector`](../rules/CodeQuality/Rector/If_/SimplifyIfIssetToNullCoalescingRector.php)

```diff
final class SomeController
{
public function run($possibleStatieYamlFile)
{
- if (isset($possibleStatieYamlFile['import'])) {
- $possibleStatieYamlFile['import'] = array_merge($possibleStatieYamlFile['import'], $filesToImport);
- } else {
- $possibleStatieYamlFile['import'] = $filesToImport;
- }
+ $possibleStatieYamlFile['import'] = array_merge($possibleStatieYamlFile['import'] ?? [], $filesToImport);
}
}
```

<br>

### SimplifyIfNotNullReturnRector

Changes redundant null check to instant return
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 @@ -57,7 +57,6 @@
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfExactValueReturnValueRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfNullableReturnRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
Expand Down Expand Up @@ -133,7 +132,6 @@
SimplifyIfElseToTernaryRector::class,
JoinStringConcatRector::class,
ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
SimplifyIfIssetToNullCoalescingRector::class,
ExplicitBoolCompareRector::class,
CombineIfRector::class,
UseIdenticalOverEqualWithSameTypeRector::class,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

198 changes: 0 additions & 198 deletions rules/CodeQuality/Rector/If_/SimplifyIfIssetToNullCoalescingRector.php

This file was deleted.

0 comments on commit 9018492

Please sign in to comment.