mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
[automated] Re-Generate Nodes/Rectors Documentation (#1284)
Co-authored-by: TomasVotruba <TomasVotruba@users.noreply.github.com>
This commit is contained in:
parent
1c5d818c75
commit
63ed131c3f
|
@ -1,4 +1,4 @@
|
|||
# 489 Rules Overview
|
||||
# 498 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
|||
|
||||
- [CodingStyle](#codingstyle) (38)
|
||||
|
||||
- [Compatibility](#compatibility) (1)
|
||||
|
||||
- [Composer](#composer) (6)
|
||||
|
||||
- [DeadCode](#deadcode) (49)
|
||||
|
@ -22,9 +24,9 @@
|
|||
|
||||
- [DowngradePhp53](#downgradephp53) (1)
|
||||
|
||||
- [DowngradePhp54](#downgradephp54) (5)
|
||||
- [DowngradePhp54](#downgradephp54) (6)
|
||||
|
||||
- [DowngradePhp55](#downgradephp55) (1)
|
||||
- [DowngradePhp55](#downgradephp55) (3)
|
||||
|
||||
- [DowngradePhp56](#downgradephp56) (3)
|
||||
|
||||
|
@ -40,7 +42,7 @@
|
|||
|
||||
- [DowngradePhp80](#downgradephp80) (19)
|
||||
|
||||
- [DowngradePhp81](#downgradephp81) (2)
|
||||
- [DowngradePhp81](#downgradephp81) (6)
|
||||
|
||||
- [EarlyReturn](#earlyreturn) (11)
|
||||
|
||||
|
@ -80,7 +82,7 @@
|
|||
|
||||
- [Php80](#php80) (17)
|
||||
|
||||
- [Php81](#php81) (7)
|
||||
- [Php81](#php81) (8)
|
||||
|
||||
- [PhpSpecToPHPUnit](#phpspectophpunit) (7)
|
||||
|
||||
|
@ -2673,6 +2675,39 @@ Wrap encapsed variables in curly braces
|
|||
|
||||
<br>
|
||||
|
||||
## Compatibility
|
||||
|
||||
### AttributeCompatibleAnnotationRector
|
||||
|
||||
Change annotation to attribute compatible form, see https://tomasvotruba.com/blog/doctrine-annotations-and-attributes-living-together-in-peace/
|
||||
|
||||
- class: [`Rector\Compatibility\Rector\Class_\AttributeCompatibleAnnotationRector`](../rules/Compatibility/Rector/Class_/AttributeCompatibleAnnotationRector.php)
|
||||
|
||||
```diff
|
||||
-use Doctrine\Common\Annotations\Annotation\Required;
|
||||
+use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
|
||||
/**
|
||||
* @annotation
|
||||
+ * @NamedArgumentConstructor
|
||||
*/
|
||||
class SomeAnnotation
|
||||
{
|
||||
/**
|
||||
- * @var string[]
|
||||
- * @Required()
|
||||
+ * @param string[] $enum
|
||||
*/
|
||||
- public array $enum;
|
||||
+ public function __construct(
|
||||
+ public array $enum
|
||||
+ ) {
|
||||
+ }
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Composer
|
||||
|
||||
### AddPackageToRequireComposerRector
|
||||
|
@ -4090,6 +4125,26 @@ Remove the "callable" param type, add a `@param` tag instead
|
|||
|
||||
<br>
|
||||
|
||||
### DowngradeIndirectCallByArrayRector
|
||||
|
||||
Downgrade indirect method call by array variable
|
||||
|
||||
- class: [`Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector`](../rules/DowngradePhp54/Rector/FuncCall/DowngradeIndirectCallByArrayRector.php)
|
||||
|
||||
```diff
|
||||
class Hello {
|
||||
public static function world($x) {
|
||||
echo "Hello, $x\n";
|
||||
}
|
||||
}
|
||||
|
||||
$func = array('Hello','world');
|
||||
-$func('you');
|
||||
+call_user_func($func, 'you');
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradeInstanceMethodCallRector
|
||||
|
||||
Downgrade instance and method call/property access
|
||||
|
@ -4140,6 +4195,21 @@ Replace short arrays by long arrays
|
|||
|
||||
## DowngradePhp55
|
||||
|
||||
### DowngradeArbitraryExpressionArgsToEmptyAndIssetRector
|
||||
|
||||
Downgrade arbitrary expression arguments to `empty()` and `isset()`
|
||||
|
||||
- class: [`Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector`](../rules/DowngradePhp55/Rector/Isset_/DowngradeArbitraryExpressionArgsToEmptyAndIssetRector.php)
|
||||
|
||||
```diff
|
||||
-if (isset(some_function())) {
|
||||
+if (some_function() !== null) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradeClassConstantToStringRector
|
||||
|
||||
Replace <class>::class constant by string class names
|
||||
|
@ -4162,6 +4232,22 @@ Replace <class>::class constant by string class names
|
|||
|
||||
<br>
|
||||
|
||||
### DowngradeForeachListRector
|
||||
|
||||
Downgrade `list()` support in foreach constructs
|
||||
|
||||
- class: [`Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector`](../rules/DowngradePhp55/Rector/Foreach_/DowngradeForeachListRector.php)
|
||||
|
||||
```diff
|
||||
-foreach ($array as $key => list($item1, $item2)) {
|
||||
+foreach ($array as $key => arrayItem) {
|
||||
+ list($item1, $item2) = $arrayItem;
|
||||
var_dump($item1, $item2);
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## DowngradePhp56
|
||||
|
||||
### DowngradeArgumentUnpackingRector
|
||||
|
@ -4831,9 +4917,8 @@ Convert the list reference assignment to its equivalent PHP 7.2 code
|
|||
{
|
||||
public function run($string)
|
||||
{
|
||||
- $array = [1, 2, 3];
|
||||
$array = [1, 2, 3];
|
||||
- list($a, &$b) = $array;
|
||||
+ $array = [1, 2];
|
||||
+ list($a) = $array;
|
||||
+ $b =& $array[1];
|
||||
|
||||
|
@ -5577,6 +5662,57 @@ Remove final from class constants
|
|||
|
||||
<br>
|
||||
|
||||
### DowngradeFirstClassCallableSyntaxRector
|
||||
|
||||
Replace variadic placeholders usage by `Closure::fromCallable()`
|
||||
|
||||
- class: [`Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector`](../rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php)
|
||||
|
||||
```diff
|
||||
-$cb = strlen(...);
|
||||
+$cb = \Closure::fromCallable('strlen');
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradeNeverTypeDeclarationRector
|
||||
|
||||
Remove "never" return type, add a `"@return` never" tag instead
|
||||
|
||||
- class: [`Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNeverTypeDeclarationRector`](../rules/DowngradePhp81/Rector/FunctionLike/DowngradeNeverTypeDeclarationRector.php)
|
||||
|
||||
```diff
|
||||
-function someFunction(): never
|
||||
+/**
|
||||
+ * @return never
|
||||
+ */
|
||||
+function someFunction()
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradeNewInInitializerRector
|
||||
|
||||
Replace New in initializers
|
||||
|
||||
- class: [`Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNewInInitializerRector`](../rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function __construct(
|
||||
- private Logger $logger = new NullLogger,
|
||||
+ private ?Logger $logger = null,
|
||||
) {
|
||||
+ $this->logger = $logger ?? new NullLogger;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradePhp81ResourceReturnToObjectRector
|
||||
|
||||
change instanceof Object to is_resource
|
||||
|
@ -5596,6 +5732,30 @@ change instanceof Object to is_resource
|
|||
|
||||
<br>
|
||||
|
||||
### DowngradeReadonlyPropertyRector
|
||||
|
||||
Remove "readonly" property type, add a "@readonly" tag instead
|
||||
|
||||
- class: [`Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector`](../rules/DowngradePhp81/Rector/Property/DowngradeReadonlyPropertyRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
- public readonly string $foo;
|
||||
+ /**
|
||||
+ * @readonly
|
||||
+ */
|
||||
+ public string $foo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->foo = 'foo';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## EarlyReturn
|
||||
|
||||
### ChangeAndIfToEarlyReturnRector
|
||||
|
@ -8179,6 +8339,27 @@ Add final to constants that
|
|||
|
||||
<br>
|
||||
|
||||
### IntersectionTypesRector
|
||||
|
||||
Change docs to intersection types, where possible (properties are covered by TypedPropertyRector (@todo))
|
||||
|
||||
- class: [`Rector\Php81\Rector\FunctionLike\IntersectionTypesRector`](../rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
- /**
|
||||
- * @param string&int $types
|
||||
- */
|
||||
- public function process($types)
|
||||
+ public function process(string&int $types)
|
||||
{
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MyCLabsClassToEnumRector
|
||||
|
||||
Refactor MyCLabs enum class to native Enum
|
||||
|
@ -8222,11 +8403,11 @@ Replace property declaration of new state with direct new
|
|||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
- private Logger $logger;
|
||||
-
|
||||
private Logger $logger;
|
||||
|
||||
public function __construct(
|
||||
- ?Logger $logger = null,
|
||||
+ private Logger $logger = new NullLogger,
|
||||
+ Logger $logger = new NullLogger,
|
||||
) {
|
||||
- $this->logger = $logger ?? new NullLogger;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user