From a9797fdc1ca6b8d7080fb1299b44fcb94ecd5936 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 21 Nov 2023 15:26:30 +0100 Subject: [PATCH] [TypeDeclaration] Deprecate TypedPropertyFromStrictGetterMethodReturnTypeRector as depends on missing context and creates invalid code (#5269) --- config/set/type-declaration.php | 2 - phpstan.neon | 4 + .../Fixture/assigned_in_construct.php.inc | 45 ----- .../Fixture/private_property.php.inc | 35 ---- .../private_property_with_single_type.php.inc | 35 ---- .../public_property_with_null_default.php.inc | 35 ---- .../Fixture/skip_default_value.php.inc | 15 -- .../Fixture/skip_doc_type.php.inc | 18 -- .../Fixture/skip_parent_guard.php.inc | 17 -- .../Fixture/some_fixture.php.inc | 35 ---- .../Fixture/some_self.php.inc | 29 ---- .../Source/ParentClassWithName.php | 10 -- ...StrictGetterMethodReturnTypeRectorTest.php | 28 --- .../config/configured_rule.php | 13 -- ...FromStrictGetterMethodReturnTypeRector.php | 160 +----------------- .../Fixture/add_null.php.inc | 45 ----- .../Fixture/default_values_string.php.inc | 38 ----- .../RemoveNullWithStrictGetterTest.php | 28 --- .../config/configured_rule.php | 17 -- .../Fixture/fixture.php.inc | 45 ----- .../StringableTypedPropertyTest.php | 28 --- .../config/configured_rule.php | 17 -- utils/Command/MissingInSetCommand.php | 2 + 23 files changed, 13 insertions(+), 688 deletions(-) delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/assigned_in_construct.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property_with_single_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/public_property_with_null_default.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_default_value.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_doc_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_parent_guard.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_fixture.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_self.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Source/ParentClassWithName.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/TypedPropertyFromStrictGetterMethodReturnTypeRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/config/configured_rule.php delete mode 100644 tests/Issues/RemoveNullWithStrictGetter/Fixture/add_null.php.inc delete mode 100644 tests/Issues/RemoveNullWithStrictGetter/Fixture/default_values_string.php.inc delete mode 100644 tests/Issues/RemoveNullWithStrictGetter/RemoveNullWithStrictGetterTest.php delete mode 100644 tests/Issues/RemoveNullWithStrictGetter/config/configured_rule.php delete mode 100644 tests/Issues/StringableTypedProperty/Fixture/fixture.php.inc delete mode 100644 tests/Issues/StringableTypedProperty/StringableTypedPropertyTest.php delete mode 100644 tests/Issues/StringableTypedProperty/config/configured_rule.php diff --git a/config/set/type-declaration.php b/config/set/type-declaration.php index 7464c5bf624..58fede5a6f2 100644 --- a/config/set/type-declaration.php +++ b/config/set/type-declaration.php @@ -36,7 +36,6 @@ use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; -use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector; return static function (RectorConfig $rectorConfig): void { @@ -51,7 +50,6 @@ AddVoidReturnTypeWhereNoReturnRector::class, ReturnTypeFromStrictFluentReturnRector::class, ReturnTypeFromReturnNewRector::class, - TypedPropertyFromStrictGetterMethodReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictNativeCallRector::class, diff --git a/phpstan.neon b/phpstan.neon index a368c2c6a61..1da6e7e362a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -538,3 +538,7 @@ parameters: - path: rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php message: "#Method \"processToClassConstFetch\\(\\)\" returns bool type, so the name should start with is/has/was#" + + # deprecated code + - '#Class "Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector" is missing @see annotation with test case class reference#' + - '#Fetching class constant class of deprecated class Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector#' diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/assigned_in_construct.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/assigned_in_construct.php.inc deleted file mode 100644 index 3aedaa32930..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/assigned_in_construct.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -name = $name; - } - - public function getName(): string - { - return $this->name; - } -} - -?> ------ -name = $name; - } - - public function getName(): string - { - return $this->name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property.php.inc deleted file mode 100644 index e8d02ef0460..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -name; - } -} - -?> ------ -name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property_with_single_type.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property_with_single_type.php.inc deleted file mode 100644 index 33848aee918..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/private_property_with_single_type.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -name; - } -} - -?> ------ -name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/public_property_with_null_default.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/public_property_with_null_default.php.inc deleted file mode 100644 index 431715ffb9d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/public_property_with_null_default.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -name; - } -} - -?> ------ -name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_default_value.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_default_value.php.inc deleted file mode 100644 index 93c8459c144..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_default_value.php.inc +++ /dev/null @@ -1,15 +0,0 @@ -name; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_doc_type.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_doc_type.php.inc deleted file mode 100644 index 7d95a2e1f6c..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_doc_type.php.inc +++ /dev/null @@ -1,18 +0,0 @@ -name; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_parent_guard.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_parent_guard.php.inc deleted file mode 100644 index 65dc4cf0cd5..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/skip_parent_guard.php.inc +++ /dev/null @@ -1,17 +0,0 @@ -name; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_fixture.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_fixture.php.inc deleted file mode 100644 index 069e1f9b69d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_fixture.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -name; - } -} - -?> ------ -name; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_self.php.inc b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_self.php.inc deleted file mode 100644 index 7a4a4f32a0b..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Fixture/some_self.php.inc +++ /dev/null @@ -1,29 +0,0 @@ -test; - } -} -?> ------ -test; - } -} -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Source/ParentClassWithName.php b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Source/ParentClassWithName.php deleted file mode 100644 index 2fc60dbe398..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/Source/ParentClassWithName.php +++ /dev/null @@ -1,10 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/config/configured_rule.php b/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/config/configured_rule.php deleted file mode 100644 index 82b07b8f87a..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector/config/configured_rule.php +++ /dev/null @@ -1,13 +0,0 @@ -rule(TypedPropertyFromStrictGetterMethodReturnTypeRector::class); - - $rectorConfig->phpVersion(PhpVersionFeature::STATIC_RETURN_TYPE); -}; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php index 4251ab8392c..ad56ee8dd35 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php @@ -5,45 +5,17 @@ namespace Rector\TypeDeclaration\Rector\Property; use PhpParser\Node; -use PhpParser\Node\Expr; -use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\Property; -use PHPStan\Type\MixedType; -use PHPStan\Type\StringType; -use PHPStan\Type\Type; -use PHPStan\Type\TypeCombinator; -use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; -use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\Core\Rector\AbstractRector; -use Rector\Core\Reflection\ReflectionResolver; -use Rector\Core\ValueObject\PhpVersionFeature; -use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover; -use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; -use Rector\Privatization\Guard\ParentPropertyLookupGuard; -use Rector\StaticTypeMapper\StaticTypeMapper; -use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector; -use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\GetterTypeDeclarationPropertyTypeInferer; -use Rector\VersionBonding\Contract\MinPhpVersionInterface; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see \Rector\Tests\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector\TypedPropertyFromStrictGetterMethodReturnTypeRectorTest + * @api + * @deprecated This rule is deprecated as created invalid code. Use other rules from TYPE_DECLARATION instead */ -final class TypedPropertyFromStrictGetterMethodReturnTypeRector extends AbstractRector implements MinPhpVersionInterface +final class TypedPropertyFromStrictGetterMethodReturnTypeRector extends AbstractRector { - public function __construct( - private readonly GetterTypeDeclarationPropertyTypeInferer $getterTypeDeclarationPropertyTypeInferer, - private readonly VarTagRemover $varTagRemover, - private readonly ParentPropertyLookupGuard $parentPropertyLookupGuard, - private readonly ReflectionResolver $reflectionResolver, - private readonly ConstructorAssignDetector $constructorAssignDetector, - private readonly PhpDocInfoFactory $phpDocInfoFactory, - private readonly StaticTypeMapper $staticTypeMapper - ) { - } - public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( @@ -90,129 +62,11 @@ public function getNodeTypes(): array */ public function refactor(Node $node): null|Class_ { - $hasChanged = false; - - foreach ($node->getProperties() as $property) { - if ($this->shouldSkipProperty($property, $node)) { - continue; - } - - $getterReturnType = $this->getterTypeDeclarationPropertyTypeInferer->inferProperty($property, $node); - if (! $getterReturnType instanceof Type) { - continue; - } - - if ($getterReturnType instanceof MixedType) { - continue; - } - - $isAssignedInConstructor = $this->constructorAssignDetector->isPropertyAssigned( - $node, - $this->getName($property) - ); - - // if property is public, it should be nullable - if ($property->isPublic() && ! TypeCombinator::containsNull( - $getterReturnType - ) && ! $isAssignedInConstructor) { - $getterReturnType = TypeCombinator::addNull($getterReturnType); - } - - $propertyTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode( - $getterReturnType, - TypeKind::PROPERTY - ); - if (! $propertyTypeNode instanceof Node) { - continue; - } - - // include fault value in the type - if ($this->isConflictingDefaultExprType($property, $getterReturnType)) { - continue; - } - - $property->type = $propertyTypeNode; - $this->decorateDefaultExpr($getterReturnType, $property, $isAssignedInConstructor); - - $this->refactorPhpDoc($property); - - $hasChanged = true; - } - - if ($hasChanged) { - return $node; - } + trigger_error( + 'This rule is deprecated as created invalid code. Use other rules from TYPE_DECLARATION instead' + ); + sleep(3); return null; } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::TYPED_PROPERTIES; - } - - private function decorateDefaultExpr(Type $propertyType, Property $property, bool $isAssignedInConstructor): void - { - if ($isAssignedInConstructor) { - return; - } - - $propertyProperty = $property->props[0]; - - // already has a default value - if ($propertyProperty->default instanceof Expr) { - return; - } - - if (TypeCombinator::containsNull($propertyType)) { - $propertyProperty->default = $this->nodeFactory->createNull(); - return; - } - - // set default for string - if ($propertyType instanceof StringType) { - $propertyProperty->default = new String_(''); - } - } - - private function isConflictingDefaultExprType(Property $property, Type $getterReturnType): bool - { - $onlyPropertyProperty = $property->props[0]; - if (! $onlyPropertyProperty->default instanceof Expr) { - return false; - } - - $defaultType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($onlyPropertyProperty->default); - - // does default type match the getter one? - return ! $defaultType->isSuperTypeOf($getterReturnType) - ->yes(); - } - - private function refactorPhpDoc(Property $property): void - { - $phpDocInfo = $this->phpDocInfoFactory->createFromNode($property); - if (! $phpDocInfo instanceof PhpDocInfo) { - return; - } - - $this->varTagRemover->removeVarTagIfUseless($phpDocInfo, $property); - } - - private function shouldSkipProperty(Property $property, Class_ $class): bool - { - if ($property->type instanceof Node) { - // already has type - return true; - } - - // skip non-single property - if (count($property->props) !== 1) { - // has too many properties - return true; - } - - $classReflection = $this->reflectionResolver->resolveClassReflection($class); - return ! $this->parentPropertyLookupGuard->isLegal($property, $classReflection); - } } diff --git a/tests/Issues/RemoveNullWithStrictGetter/Fixture/add_null.php.inc b/tests/Issues/RemoveNullWithStrictGetter/Fixture/add_null.php.inc deleted file mode 100644 index 437f650f660..00000000000 --- a/tests/Issues/RemoveNullWithStrictGetter/Fixture/add_null.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -name = $name; - } - - public function getName(): ?string - { - return $this->name; - } -} - -?> ------ -name = $name; - } - - public function getName(): ?string - { - return $this->name; - } -} - -?> diff --git a/tests/Issues/RemoveNullWithStrictGetter/Fixture/default_values_string.php.inc b/tests/Issues/RemoveNullWithStrictGetter/Fixture/default_values_string.php.inc deleted file mode 100644 index f230103d581..00000000000 --- a/tests/Issues/RemoveNullWithStrictGetter/Fixture/default_values_string.php.inc +++ /dev/null @@ -1,38 +0,0 @@ -name; - } -} - -?> ------ -name; - } -} - -?> diff --git a/tests/Issues/RemoveNullWithStrictGetter/RemoveNullWithStrictGetterTest.php b/tests/Issues/RemoveNullWithStrictGetter/RemoveNullWithStrictGetterTest.php deleted file mode 100644 index ad99466fe88..00000000000 --- a/tests/Issues/RemoveNullWithStrictGetter/RemoveNullWithStrictGetterTest.php +++ /dev/null @@ -1,28 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/tests/Issues/RemoveNullWithStrictGetter/config/configured_rule.php b/tests/Issues/RemoveNullWithStrictGetter/config/configured_rule.php deleted file mode 100644 index 168c1be3c17..00000000000 --- a/tests/Issues/RemoveNullWithStrictGetter/config/configured_rule.php +++ /dev/null @@ -1,17 +0,0 @@ -rule(TypedPropertyFromStrictGetterMethodReturnTypeRector::class); - - // should be ignored if typed property is used - $rectorConfig->rule(RemoveNullPropertyInitializationRector::class); - - $rectorConfig->phpVersion(PhpVersion::PHP_74); -}; diff --git a/tests/Issues/StringableTypedProperty/Fixture/fixture.php.inc b/tests/Issues/StringableTypedProperty/Fixture/fixture.php.inc deleted file mode 100644 index 9db529a8be3..00000000000 --- a/tests/Issues/StringableTypedProperty/Fixture/fixture.php.inc +++ /dev/null @@ -1,45 +0,0 @@ -nickname; - } - - public function getNickname(): ?string - { - return $this->nickname; - } -} - -?> ------ -nickname; - } - - public function getNickname(): ?string - { - return $this->nickname; - } -} - -?> diff --git a/tests/Issues/StringableTypedProperty/StringableTypedPropertyTest.php b/tests/Issues/StringableTypedProperty/StringableTypedPropertyTest.php deleted file mode 100644 index e4fc0d8c5c1..00000000000 --- a/tests/Issues/StringableTypedProperty/StringableTypedPropertyTest.php +++ /dev/null @@ -1,28 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/tests/Issues/StringableTypedProperty/config/configured_rule.php b/tests/Issues/StringableTypedProperty/config/configured_rule.php deleted file mode 100644 index 886d2156352..00000000000 --- a/tests/Issues/StringableTypedProperty/config/configured_rule.php +++ /dev/null @@ -1,17 +0,0 @@ -phpVersion(PhpVersionFeature::STRINGABLE); - - $rectorConfig->rules([ - StringableForToStringRector::class, - TypedPropertyFromStrictGetterMethodReturnTypeRector::class, - ]); -}; diff --git a/utils/Command/MissingInSetCommand.php b/utils/Command/MissingInSetCommand.php index 623fedfe0d8..cc7a49e6c26 100644 --- a/utils/Command/MissingInSetCommand.php +++ b/utils/Command/MissingInSetCommand.php @@ -11,6 +11,7 @@ use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenCollectorRector; use Rector\TypeDeclaration\Rector\BooleanAnd\BinaryOpNullableToInstanceofRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorReadonlyClassRector; +use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector; use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; use Rector\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector; use Rector\Utils\Enum\RectorDirectoryToSetFileMap; @@ -36,6 +37,7 @@ final class MissingInSetCommand extends Command FinalizeClassesWithoutChildrenCollectorRector::class, // deprecated TypedPropertyFromStrictConstructorReadonlyClassRector::class, + TypedPropertyFromStrictGetterMethodReturnTypeRector::class, BinarySwitchToIfElseRector::class, CountOnNullRector::class, ];