Skip to content

Commit

Permalink
[Transform] Remove unused ClassConstFetchToValueRector (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Nov 28, 2021
1 parent 00dd0eb commit fa9b4ef
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 267 deletions.
58 changes: 19 additions & 39 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

- [Composer](#composer) (6)

- [DeadCode](#deadcode) (49)
- [DeadCode](#deadcode) (50)

- [DependencyInjection](#dependencyinjection) (2)

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

- [Strict](#strict) (5)

- [Transform](#transform) (36)
- [Transform](#transform) (35)

- [TypeDeclaration](#typedeclaration) (22)

Expand Down Expand Up @@ -3104,6 +3104,21 @@ Remove empty constructor

<br>

### RemoveDeadContinueRector

Remove useless continue at the end of loops

- class: [`Rector\DeadCode\Rector\For_\RemoveDeadContinueRector`](../rules/DeadCode/Rector/For_/RemoveDeadContinueRector.php)

```diff
while ($i < 10) {
++$i;
- continue;
}
```

<br>

### RemoveDeadIfForeachForRector

Remove if, foreach and for that does not do anything
Expand Down Expand Up @@ -10451,41 +10466,6 @@ Change singleton class to normal class that can be registered as a service

<br>

### ClassConstFetchToValueRector

Replaces constant by value

:wrench: **configure it!**

- class: [`Rector\Transform\Rector\ClassConstFetch\ClassConstFetchToValueRector`](../rules/Transform/Rector/ClassConstFetch/ClassConstFetchToValueRector.php)

```php
use Rector\Transform\Rector\ClassConstFetch\ClassConstFetchToValueRector;
use Rector\Transform\ValueObject\ClassConstFetchToValue;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->set(ClassConstFetchToValueRector::class)
->call('configure', [[
ClassConstFetchToValueRector::CLASS_CONST_FETCHES_TO_VALUES => ValueObjectInliner::inline([
new ClassConstFetchToValue('Nette\Configurator', 'PRODUCTION', 'production'),
]),
]]);
};
```


```diff
-$value === Nette\Configurator::DEVELOPMENT
+$value === "development"
```

<br>

### DimFetchAssignToMethodCallRector

Change magic array access add to `$list[],` to explicit `$list->addMethod(...)`
Expand Down Expand Up @@ -11543,8 +11523,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
{
public function run()
{
- $dotenv = JsonResponse::create(true);
+ $dotenv = new JsonResponse();
- $dotenv = JsonResponse::create(['foo' => 'bar'], Response::HTTP_OK);
+ $dotenv = new JsonResponse(['foo' => 'bar'], Response::HTTP_OK);
}
}
```
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions rules/Transform/ValueObject/ClassConstFetchToValue.php

This file was deleted.

0 comments on commit fa9b4ef

Please sign in to comment.