Skip to content

Commit

Permalink
[automated] Re-Generate Nodes/Rectors Documentation (#3521)
Browse files Browse the repository at this point in the history
Co-authored-by: TomasVotruba <TomasVotruba@users.noreply.github.com>
  • Loading branch information
TomasVotruba and TomasVotruba committed Mar 26, 2023
1 parent 6c8aa92 commit ad9b597
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,16 +706,17 @@ Replace magic property fetch using `__get()` and `__set()` with existing method

### FlipTypeControlToUseExclusiveTypeRector

Flip type control to use exclusive type
Flip type control from null compare to use exclusive instanceof type

- class: [`Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector`](../rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php)

```diff
-/** @var PhpDocInfo|null $phpDocInfo */
$phpDocInfo = $functionLike->getAttribute(AttributeKey::PHP_DOC_INFO);
-if ($phpDocInfo === null) {
+if (! $phpDocInfo instanceof PhpDocInfo) {
return;
function process(?DateTime $dateTime)
{
- if ($dateTime === null) {
+ if (! $dateTime instanceof DateTime) {
return;
}
}
```

Expand Down Expand Up @@ -2060,19 +2061,13 @@ Change data provider in PHPUnit test case to newline per item

### EncapsedStringsToSprintfRector

Convert enscaped {$string} to more readable sprintf
Convert enscaped {$string} to more readable sprintf or concat, if no mask is used

- class: [`Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector`](../rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php)

```diff
final class SomeClass
{
public function run(string $format)
{
- return "Unsupported format {$format}";
+ return sprintf('Unsupported format %s', $format);
}
}
-echo "Unsupported format {$format}";
+echo sprintf('Unsupported format %s', $format);
```

<br>
Expand Down

0 comments on commit ad9b597

Please sign in to comment.