Skip to content

Commit

Permalink
[DeadCode] Remove RemoveAssignOfVoidReturnFunctionRector as unreliabl…
Browse files Browse the repository at this point in the history
…e, let PHPStan report and use handle various cases (#1313)
  • Loading branch information
TomasVotruba committed Nov 25, 2021
1 parent 51d369a commit aa72166
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 330 deletions.
34 changes: 6 additions & 28 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 499 Rules Overview
# 498 Rules Overview

<br>

Expand All @@ -18,7 +18,7 @@

- [Composer](#composer) (6)

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

- [DependencyInjection](#dependencyinjection) (2)

Expand Down Expand Up @@ -3014,29 +3014,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {

<br>

### RemoveAssignOfVoidReturnFunctionRector

Remove assign of void function/method to variable

- class: [`Rector\DeadCode\Rector\Assign\RemoveAssignOfVoidReturnFunctionRector`](../rules/DeadCode/Rector/Assign/RemoveAssignOfVoidReturnFunctionRector.php)

```diff
class SomeClass
{
public function run()
{
- $value = $this->getOne();
+ $this->getOne();
}

private function getOne(): void
{
}
}
```

<br>

### RemoveCodeAfterReturnRector

Remove dead code after return statement
Expand Down Expand Up @@ -7990,9 +7967,10 @@ Change simple property init and assign to constructor promotion
{
- public float $someVariable;
-
- public function __construct(float $someVariable = 0.0)
+ public function __construct(private float $someVariable = 0.0)
{
public function __construct(
- float $someVariable = 0.0
+ private float $someVariable = 0.0
) {
- $this->someVariable = $someVariable;
}
}
Expand Down
2 changes: 0 additions & 2 deletions config/set/dead-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector;
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
use Rector\DeadCode\Rector\Assign\RemoveAssignOfVoidReturnFunctionRector;
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\BinaryOp\RemoveDuplicatedInstanceOfRector;
Expand Down Expand Up @@ -85,7 +84,6 @@
$services->set(RemoveUnusedVariableAssignRector::class);
$services->set(RemoveDuplicatedIfReturnRector::class);
$services->set(RemoveUnusedNonEmptyArrayBeforeForeachRector::class);
$services->set(RemoveAssignOfVoidReturnFunctionRector::class);
$services->set(RemoveEmptyMethodCallRector::class);
$services->set(RemoveDeadConditionAboveReturnRector::class);
$services->set(RemoveUnusedConstructorParamRector::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.

0 comments on commit aa72166

Please sign in to comment.