Skip to content

Commit

Permalink
[CodingStyle] Deprecate RemoveUnusedAliasRector, job rather for codin…
Browse files Browse the repository at this point in the history
…g standard tool and opinonated (#1157)
  • Loading branch information
TomasVotruba authored Nov 5, 2021
1 parent 0c3527e commit 49aa15d
Show file tree
Hide file tree
Showing 50 changed files with 22 additions and 1,651 deletions.
42 changes: 22 additions & 20 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

- [CodeQuality](#codequality) (69)

- [CodingStyle](#codingstyle) (39)
- [CodingStyle](#codingstyle) (38)

- [Composer](#composer) (6)

Expand Down Expand Up @@ -76,7 +76,7 @@

- [Php80](#php80) (17)

- [Php81](#php81) (5)
- [Php81](#php81) (6)

- [PhpSpecToPHPUnit](#phpspectophpunit) (7)

Expand Down Expand Up @@ -2352,24 +2352,6 @@ Non-magic PHP object methods cannot start with "__"

<br>

### RemoveUnusedAliasRector

Removes unused use aliases. Keep annotation aliases like "Doctrine\ORM\Mapping as ORM" to keep convention format

- class: [`Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector`](../rules/CodingStyle/Rector/Use_/RemoveUnusedAliasRector.php)

```diff
-use Symfony\Kernel as BaseKernel;
+use Symfony\Kernel;

-class SomeClass extends BaseKernel
+class SomeClass extends Kernel
{
}
```

<br>

### ReturnArrayClassMethodToYieldRector

Turns array return to yield return in specific type and method
Expand Down Expand Up @@ -8025,6 +8007,26 @@ Refactor MyCLabs enum fetch to Enum const

<br>

### Php81ResourceReturnToObjectRector

Change `is_resource()` to instanceof Object

- class: [`Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector`](../rules/Php81/Rector/FuncCall/Php81ResourceReturnToObjectRector.php)

```diff
class SomeClass
{
public function run()
{
$f = finfo_open();
- is_resource($f);
+ $f instanceof \finfo;
}
}
```

<br>

### ReadOnlyPropertyRector

Decorate read-only property with `readonly` attribute
Expand Down
2 changes: 0 additions & 2 deletions config/set/coding-style.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
use Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector;
use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
Expand All @@ -43,7 +42,6 @@
$services->set(BinarySwitchToIfElseRector::class);
$services->set(ConsistentImplodeRector::class);
$services->set(TernaryConditionVariableAssignmentRector::class);
$services->set(RemoveUnusedAliasRector::class);
$services->set(SymplifyQuoteEscapeRector::class);
$services->set(SplitGroupedConstantsAndPropertiesRector::class);
$services->set(SplitStringClassConstantToClassConstFetchRector::class);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

119 changes: 0 additions & 119 deletions packages/NameImporting/NodeAnalyzer/UseAnalyzer.php

This file was deleted.

Loading

0 comments on commit 49aa15d

Please sign in to comment.