mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-31 12:42:05 +01:00
update docs
This commit is contained in:
parent
5b66087b48
commit
018fdf9340
@ -1,4 +1,4 @@
|
||||
# All 415 Rectors Overview
|
||||
# All 418 Rectors Overview
|
||||
|
||||
- [Projects](#projects)
|
||||
- [General](#general)
|
||||
@ -21,6 +21,7 @@
|
||||
- [Guzzle](#guzzle)
|
||||
- [Laravel](#laravel)
|
||||
- [Legacy](#legacy)
|
||||
- [MinimalScope](#minimalscope)
|
||||
- [MysqlToMysqli](#mysqltomysqli)
|
||||
- [Nette](#nette)
|
||||
- [NetteTesterToPHPUnit](#nettetestertophpunit)
|
||||
@ -585,6 +586,28 @@ Make if conditions more explicit
|
||||
|
||||
<br>
|
||||
|
||||
### `ForRepeatedCountToOwnVariableRector`
|
||||
|
||||
- class: `Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector`
|
||||
|
||||
Change count() in for function to own variable
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run($items)
|
||||
{
|
||||
- for ($i = 5; $i <= count($items); $i++) {
|
||||
+ $itemsCount = count($items);
|
||||
+ for ($i = 5; $i <= $itemsCount; $i++) {
|
||||
echo $items[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### `ForToForeachRector`
|
||||
|
||||
- class: `Rector\CodeQuality\Rector\For_\ForToForeachRector`
|
||||
@ -613,6 +636,28 @@ Change for() to foreach() where useful
|
||||
|
||||
<br>
|
||||
|
||||
### `ForeachItemsAssignToEmptyArrayToAssignRector`
|
||||
|
||||
- class: `Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector`
|
||||
|
||||
Change foreach() items assign to empty array to direct assign
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run($items)
|
||||
{
|
||||
$items2 = [];
|
||||
- foreach ($items as $item) {
|
||||
- $items2[] = $item;
|
||||
- }
|
||||
+ $items2 = $items;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### `ForeachToInArrayRector`
|
||||
|
||||
- class: `Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector`
|
||||
@ -3239,6 +3284,30 @@ Change singleton class to normal class that can be registered as a service
|
||||
|
||||
<br>
|
||||
|
||||
## MinimalScope
|
||||
|
||||
### `ChangeLocalPropertyToVariableRector`
|
||||
|
||||
- class: `Rector\MinimalScope\Rector\Class_\ChangeLocalPropertyToVariableRector`
|
||||
|
||||
Change local property used in single method to local variable
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
- private $count;
|
||||
public function run()
|
||||
{
|
||||
- $this->count = 5;
|
||||
- return $this->count;
|
||||
+ $count = 5;
|
||||
+ return $count;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## MysqlToMysqli
|
||||
|
||||
### `MysqlAssignToMysqliRector`
|
||||
|
Loading…
x
Reference in New Issue
Block a user