Skip to content

Commit

Permalink
Remove ChangeReflectionTypeToStringToGetNameRector as niche and overl…
Browse files Browse the repository at this point in the history
…y detailed, better refactor reflectio na as a whole (#3976)
  • Loading branch information
TomasVotruba committed May 26, 2023
1 parent c1cb710 commit bb3d37a
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 460 deletions.
29 changes: 1 addition & 28 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

- [Php73](#php73) (9)

- [Php74](#php74) (14)
- [Php74](#php74) (13)

- [Php80](#php80) (20)

Expand Down Expand Up @@ -5345,33 +5345,6 @@ Change `array_merge()` to spread operator

<br>

### ChangeReflectionTypeToStringToGetNameRector

Change string calls on ReflectionType

- class: [`Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector`](../rules/Php74/Rector/MethodCall/ChangeReflectionTypeToStringToGetNameRector.php)

```diff
class SomeClass
{
public function go(ReflectionFunction $reflectionFunction)
{
$parameterReflection = $reflectionFunction->getParameters()[0];

- $paramType = (string) $parameterReflection->getType();
+ $paramType = (string) ($parameterReflection->getType() ? $parameterReflection->getType()->getName() : null);

- $stringValue = 'hey' . $reflectionFunction->getReturnType();
+ $stringValue = 'hey' . ($reflectionFunction->getReturnType() ? $reflectionFunction->getReturnType()->getName() : null);

// keep
return $reflectionFunction->getReturnType();
}
}
```

<br>

### ClosureToArrowFunctionRector

Change closure to arrow function
Expand Down
2 changes: 0 additions & 2 deletions config/set/php74.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
use Rector\Php74\Rector\FuncCall\MoneyFormatToNumberFormatRector;
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
use Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
use Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector;
use Rector\Php74\Rector\Ternary\ParenthesizeNestedTernaryRector;
Expand Down Expand Up @@ -42,7 +41,6 @@
ClosureToArrowFunctionRector::class,
ArraySpreadInsteadOfArrayMergeRector::class,
AddLiteralSeparatorToNumberRector::class,
ChangeReflectionTypeToStringToGetNameRector::class,
RestoreDefaultNullToNullableTypePropertyRector::class,
CurlyToSquareBracketArrayStringRector::class,
MoneyFormatToNumberFormatRector::class,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bb3d37a

Please sign in to comment.