Skip to content

Commit

Permalink
rebuild docs (#6107)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Jul 3, 2024
1 parent fd5f15c commit 2b2bbd1
Showing 1 changed file with 17 additions and 68 deletions.
85 changes: 17 additions & 68 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 379 Rules Overview
# 376 Rules Overview

<br>

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

- [Transform](#transform) (25)

- [TypeDeclaration](#typedeclaration) (55)
- [TypeDeclaration](#typedeclaration) (52)

- [Visibility](#visibility) (3)

Expand Down Expand Up @@ -6436,72 +6436,6 @@ Add "never" return-type for closure that never return anything

<br>

### AddClosureReturnTypeFromReturnCastRector

Add return type to closure with return cast

- class: [`Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeFromReturnCastRector`](../rules/TypeDeclaration/Rector/Closure/AddClosureReturnTypeFromReturnCastRector.php)

```diff
-function ($param) {
+function ($param): string {
return (string) $param;
};
```

<br>

### AddClosureReturnTypeFromStrictNativeCallRector

Add closure strict return type based native function or native method

- class: [`Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeFromStrictNativeCallRector`](../rules/TypeDeclaration/Rector/Closure/AddClosureReturnTypeFromStrictNativeCallRector.php)

```diff
-function () {
+function (): string {
$dt = new DateTime('now');
return $dt->format('Y-m-d');
};
```

<br>

### AddClosureReturnTypeFromStrictParamRector

Add closure return type based on strict parameter type

- class: [`Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeFromStrictParamRector`](../rules/TypeDeclaration/Rector/Closure/AddClosureReturnTypeFromStrictParamRector.php)

```diff
-function(ParamType $item)
+function(ParamType $item): ParamType
{
return $item;
};
```

<br>

### AddClosureUnionReturnTypeRector

Add union return type on closure

- class: [`Rector\TypeDeclaration\Rector\Closure\AddClosureUnionReturnTypeRector`](../rules/TypeDeclaration/Rector/Closure/AddClosureUnionReturnTypeRector.php)

```diff
-function () {
+function (): int|string {
if (rand(0, 1)) {
return 1;
}

return 'one';
};
```

<br>

### AddClosureVoidReturnTypeWhereNoReturnRector

Add closure return type void if there is no return
Expand Down Expand Up @@ -6884,6 +6818,21 @@ Add return type to classes that extend `Doctrine\ORM\EntityRepository` based on

<br>

### ClosureReturnTypeRector

Add return type to closures based on known return values

- class: [`Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector`](../rules/TypeDeclaration/Rector/Closure/ClosureReturnTypeRector.php)

```diff
-function () {
+function (): int {
return 100;
};
```

<br>

### DeclareStrictTypesRector

Add declare(strict_types=1) if missing
Expand Down

0 comments on commit 2b2bbd1

Please sign in to comment.