Skip to content

Commit

Permalink
[automated] Re-Generate Nodes/Rectors Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jan 9, 2022
1 parent 1dc9483 commit ea2ea17
Showing 1 changed file with 81 additions and 6 deletions.
87 changes: 81 additions & 6 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 512 Rules Overview
# 516 Rules Overview

<br>

Expand Down Expand Up @@ -28,7 +28,7 @@

- [DowngradePhp56](#downgradephp56) (5)

- [DowngradePhp70](#downgradephp70) (15)
- [DowngradePhp70](#downgradephp70) (18)

- [DowngradePhp71](#downgradephp71) (10)

Expand All @@ -38,7 +38,7 @@

- [DowngradePhp74](#downgradephp74) (12)

- [DowngradePhp80](#downgradephp80) (26)
- [DowngradePhp80](#downgradephp80) (27)

- [DowngradePhp81](#downgradephp81) (8)

Expand Down Expand Up @@ -4173,6 +4173,24 @@ Remove anonymous class

<br>

### DowngradeCatchThrowableRector

Make catch clauses catching `Throwable` also catch `Exception` to support exception hierarchies in PHP 5.

- class: [`Rector\DowngradePhp70\Rector\TryCatch\DowngradeCatchThrowableRector`](../rules/DowngradePhp70/Rector/TryCatch/DowngradeCatchThrowableRector.php)

```diff
try {
// Some code...
} catch (\Throwable $exception) {
handle();
+} catch (\Exception $exception) {
+ handle();
}
```

<br>

### DowngradeClosureCallRector

Replace `Closure::call()` by `Closure::bindTo()`
Expand Down Expand Up @@ -4238,6 +4256,19 @@ Refactor scalar types in PHP code in string snippets, e.g. generated container c

<br>

### DowngradeInstanceofThrowableRector

Add `instanceof Exception` check as a fallback to `instanceof Throwable` to support exception hierarchies in PHP 5

- class: [`Rector\DowngradePhp70\Rector\Instanceof_\DowngradeInstanceofThrowableRector`](../rules/DowngradePhp70/Rector/Instanceof_/DowngradeInstanceofThrowableRector.php)

```diff
-return $e instanceof \Throwable;
+return ($throwable = $e) instanceof \Throwable || $throwable instanceof \Exception;
```

<br>

### DowngradeMethodCallOnCloneRector

Replace (clone `$obj)->call()` to object assign and call
Expand Down Expand Up @@ -4406,6 +4437,33 @@ Replace `Throwable` type hints by PHPDoc tags

<br>

### DowngradeUncallableValueCallToCallUserFuncRector

Downgrade calling a value that is not directly callable in PHP 5 (property, static property, closure, …) to call_user_func.

- class: [`Rector\DowngradePhp70\Rector\FuncCall\DowngradeUncallableValueCallToCallUserFuncRector`](../rules/DowngradePhp70/Rector/FuncCall/DowngradeUncallableValueCallToCallUserFuncRector.php)

```diff
final class Foo
{
/** @var callable */
public $handler;
/** @var callable */
public static $staticHandler;
}

$foo = new Foo;
-($foo->handler)(/* args */);
-($foo::$staticHandler)(41);
+call_user_func($foo->handler, /* args */);
+call_user_func($foo::$staticHandler, 41);

-(function() { /* … */ })();
+call_user_func(function() { /* … */ });
```

<br>

### SplitGroupedUseImportsRector

Refactor grouped use imports to standalone lines
Expand Down Expand Up @@ -5394,6 +5452,25 @@ Change nullsafe operator to ternary operator rector

<br>

### DowngradeNumberFormatNoFourthArgRector

Downgrade number_format arg to fill 4th arg when only 3rd arg filled

- class: [`Rector\DowngradePhp80\Rector\FuncCall\DowngradeNumberFormatNoFourthArgRector`](../rules/DowngradePhp80/Rector/FuncCall/DowngradeNumberFormatNoFourthArgRector.php)

```diff
class SomeClass
{
public function run()
{
- return number_format(1000, 2, ',');
+ return number_format(1000, 2, ',', ',');
}
}
```

<br>

### DowngradePhp80ResourceReturnToObjectRector

change instanceof Object to is_resource
Expand Down Expand Up @@ -11759,9 +11836,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {

$services->set(AddReturnTypeDeclarationRector::class)
->configure(
[new AddReturnTypeDeclaration('SomeClass', 'getData', new ArrayType(new MixedType(false), new MixedType(
false
)))]
[new AddReturnTypeDeclaration('SomeClass', 'getData', new ArrayType(new MixedType(), new MixedType()))]
);
};
```
Expand Down

0 comments on commit ea2ea17

Please sign in to comment.