Skip to content

Commit

Permalink
[CodingStyle] Remove PreslashSimpleFunctionRector, let php-cs-fixer d…
Browse files Browse the repository at this point in the history
…oing good work handle that (#1310)
  • Loading branch information
TomasVotruba committed Nov 25, 2021
1 parent 2215cb2 commit dc07c1f
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 361 deletions.
70 changes: 9 additions & 61 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 501 Rules Overview
# 499 Rules Overview

<br>

Expand All @@ -12,15 +12,15 @@

- [CodeQuality](#codequality) (69)

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

- [Compatibility](#compatibility) (1)

- [Composer](#composer) (6)

- [DeadCode](#deadcode) (50)

- [DependencyInjection](#dependencyinjection) (3)
- [DependencyInjection](#dependencyinjection) (2)

- [DowngradePhp53](#downgradephp53) (1)

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

<br>

### PreslashSimpleFunctionRector

Add pre-slash to short named functions to improve performance

- class: [`Rector\CodingStyle\Rector\FuncCall\PreslashSimpleFunctionRector`](../rules/CodingStyle/Rector/FuncCall/PreslashSimpleFunctionRector.php)

```diff
class SomeClass
{
public function shorten($value)
{
- return trim($value);
+ return \trim($value);
}
}
```

<br>

### RemoveDoubleUnderscoreInMethodNameRector

Non-magic PHP object methods cannot start with "__"
Expand Down Expand Up @@ -4001,18 +3982,14 @@ Turns action injection in Controllers to constructor injection
final class SomeController
{
- public function default(ProductRepository $productRepository)
+ /**
+ * @var ProductRepository
+ */
+ private $productRepository;
+ public function __construct(ProductRepository $productRepository)
{
- $products = $productRepository->fetchAll();
+ $this->productRepository = $productRepository;
+ public function __construct(
+ private ProductRepository $productRepository
+ ) {
+ }
+
+ public function default()
+ {
{
- $products = $productRepository->fetchAll();
+ $products = $this->productRepository->fetchAll();
}
}
Expand Down Expand Up @@ -4060,35 +4037,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {

<br>

### ReplaceVariableByPropertyFetchRector

Turns variable in controller action to property fetch, as follow up to action injection variable to property change.

- class: [`Rector\DependencyInjection\Rector\Variable\ReplaceVariableByPropertyFetchRector`](../rules/DependencyInjection/Rector/Variable/ReplaceVariableByPropertyFetchRector.php)

```diff
final class SomeController
{
/**
* @var ProductRepository
*/
private $productRepository;

public function __construct(ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}

public function default()
{
- $products = $productRepository->fetchAll();
+ $products = $this->productRepository->fetchAll();
}
}
```

<br>

## DowngradePhp53

### DirConstToFileConstRector
Expand Down Expand Up @@ -8883,7 +8831,7 @@ Add unique use imports collected during Rector run

Change global `$variables` to private properties

- class: [`Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector`](../rules/Privatization/Rector/ClassMethod/ChangeGlobalVariablesToPropertiesRector.php)
- class: [`Rector\Privatization\Rector\Class_\ChangeGlobalVariablesToPropertiesRector`](../rules/Privatization/Rector/Class_/ChangeGlobalVariablesToPropertiesRector.php)

```diff
class SomeClass
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.

Loading

0 comments on commit dc07c1f

Please sign in to comment.