mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-16 13:33:13 +02:00
update docs
This commit is contained in:
parent
20374f53a4
commit
9fae3bf1d1
@ -9,6 +9,7 @@
|
||||
- [CodeQuality\Assign](#codequalityassign)
|
||||
- [CodeQuality\BinaryOp](#codequalitybinaryop)
|
||||
- [CodeQuality\BooleanAnd](#codequalitybooleanand)
|
||||
- [CodeQuality\Concat](#codequalityconcat)
|
||||
- [CodeQuality\Foreach_](#codequalityforeach_)
|
||||
- [CodeQuality\FuncCall](#codequalityfunccall)
|
||||
- [CodeQuality\Identical](#codequalityidentical)
|
||||
@ -151,6 +152,27 @@ Simplify `is_array` and `empty` functions combination into a simple identical ch
|
||||
|
||||
<br>
|
||||
|
||||
## CodeQuality\Concat
|
||||
|
||||
### `JoinStringConcatRector`
|
||||
|
||||
- class: `Rector\CodeQuality\Rector\Concat\JoinStringConcatRector`
|
||||
|
||||
Joins concat of 2 strings
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
- $name = 'Hi' . ' Tom';
|
||||
+ $name = 'Hi Tom';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## CodeQuality\Foreach_
|
||||
|
||||
### `ForeachToInArrayRector`
|
||||
@ -512,7 +534,7 @@ services:
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
- yeild 'event' => 'callback';
|
||||
- yield 'event' => 'callback';
|
||||
+ return ['event' => 'callback'];
|
||||
}
|
||||
}
|
||||
@ -537,17 +559,13 @@ services:
|
||||
|
||||
```diff
|
||||
class SomeEventSubscriber implements EventSubscriberInterface
|
||||
-{
|
||||
- public static function getSubscribedEvents()
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
- yeild 'event' => 'callback';
|
||||
- }
|
||||
-}
|
||||
+ public static function getSubscribedEvents()
|
||||
+ {
|
||||
+ return ['event' => 'callback'];
|
||||
+ }
|
||||
+ }
|
||||
- yield 'event' => 'callback';
|
||||
+ return ['event' => 'callback'];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
@ -1043,28 +1061,6 @@ Takes `setExpectedException()` 2nd and next arguments to own methods in PHPUnit.
|
||||
|
||||
<br>
|
||||
|
||||
### `ArrayToYieldDataProviderRector`
|
||||
|
||||
- class: `Rector\PHPUnit\Rector\ArrayToYieldDataProviderRector`
|
||||
|
||||
Turns method data providers in PHPUnit from arrays to yield
|
||||
|
||||
```diff
|
||||
/**
|
||||
- * @return mixed[]
|
||||
*/
|
||||
-public function provide(): array
|
||||
+public function provide(): Iterator
|
||||
{
|
||||
- return [
|
||||
- ['item']
|
||||
- ]
|
||||
+ yield ['item'];
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### `TryCatchToExpectExceptionRector`
|
||||
|
||||
- class: `Rector\PHPUnit\Rector\TryCatchToExpectExceptionRector`
|
||||
|
@ -58,7 +58,7 @@ class SomeEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
yeild 'event' => 'callback';
|
||||
yield 'event' => 'callback';
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
|
@ -47,19 +47,19 @@ class SomeEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
yeild 'event' => 'callback';
|
||||
yield 'event' => 'callback';
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
,
|
||||
<<<'CODE_SAMPLE'
|
||||
class SomeEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return ['event' => 'callback'];
|
||||
}
|
||||
return ['event' => 'callback'];
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
,
|
||||
[
|
||||
|
Loading…
x
Reference in New Issue
Block a user