From 3417ff434b02f620c0c953c67846c8c7c63ae0b6 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 15 Dec 2021 01:30:14 +0100 Subject: [PATCH] [TypeDeclaration] Remove CompleteVarDocTypePropertyRector, is handled by split rules (#1500) --- .../docs/rector_rules_overview.md | 44 +++++---- composer.json | 1 - .../AutoImportTest.php | 36 -------- .../CompleteVarDocTypePropertyRectorTest.php | 36 -------- .../Fixture/assign_conflict.php.inc | 54 ----------- .../Fixture/default_value.php.inc | 45 --------- .../Fixture/default_value_array_mixed.php.inc | 24 ----- .../improve_type_and_keep_comment.php.inc | 43 --------- .../Fixture/object_cast_to_stdclass.php.inc | 37 -------- .../Fixture/private_var_null_unused.php.inc | 24 ----- .../Fixture/property_assign.php.inc | 34 ------- .../Fixture/public_var_null_used.php.inc | 38 -------- ...ursive_multiple_class_string_array.php.inc | 60 ------------ .../Fixture/skip_already_used.php.inc | 18 ---- .../Fixture/skip_more_specific.php.inc | 29 ------ .../skip_multiple_class_string_array.php.inc | 21 ----- .../skip_public_var_null_unused.php.inc | 8 -- .../Fixture/some_callable_type.php.inc | 52 ----------- ...ole_command_defined_in_constructor.php.inc | 62 ------------- .../symfony_console_helper_set.php.inc | 76 --------------- .../Fixture/typed_array.php.inc | 40 -------- .../Fixture/typed_array_nested.php.inc | 40 -------- .../Fixture/with_numeric_check.php.inc | 47 ---------- .../keep_simple_class.php.inc | 18 ---- .../Source/EventDispatcher.php | 8 -- .../Source/SomeService.php | 10 -- .../config/auto_import.php | 15 --- .../config/configured_rule.php | 11 --- .../CompleteVarDocTypePropertyRector.php | 92 ------------------- 29 files changed, 21 insertions(+), 1002 deletions(-) delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/AutoImportTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/CompleteVarDocTypePropertyRectorTest.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/assign_conflict.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value_array_mixed.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/improve_type_and_keep_comment.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/object_cast_to_stdclass.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/private_var_null_unused.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/property_assign.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/public_var_null_used.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/recursive_multiple_class_string_array.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_already_used.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_more_specific.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_multiple_class_string_array.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_public_var_null_unused.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/some_callable_type.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_command_defined_in_constructor.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_helper_set.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array_nested.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/with_numeric_check.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/FixtureAutoImport/keep_simple_class.php.inc delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/SomeService.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/config/auto_import.php delete mode 100644 rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/config/configured_rule.php delete mode 100644 rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php diff --git a/build/target-repository/docs/rector_rules_overview.md b/build/target-repository/docs/rector_rules_overview.md index 720740fa0aa..1fd41a246c6 100644 --- a/build/target-repository/docs/rector_rules_overview.md +++ b/build/target-repository/docs/rector_rules_overview.md @@ -11693,29 +11693,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {
-### CompleteVarDocTypePropertyRector - -Complete property `@var` annotations or correct the old ones - -- class: [`Rector\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector`](../rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php) - -```diff - final class SomeClass - { -+ /** -+ * @var EventDispatcher -+ */ - private $eventDispatcher; - - public function __construct(EventDispatcher $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } - } -``` - -
- ### FormerNullableArgumentToScalarTypedRector Change null in argument, that is now not nullable anymore @@ -11984,6 +11961,27 @@ Add return method return type based on strict typed property
+### TypedPropertyFromAssignsRector + +Add typed property from assigned types + +- class: [`Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector`](../rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php) + +```diff + final class SomeClass + { +- private $name; ++ private string|null $name = null; + + public function run() + { + $this->name = 'string'; + } + } +``` + +
+ ### TypedPropertyFromStrictConstructorRector Add typed properties based only on strict constructor types diff --git a/composer.json b/composer.json index b4383fc9c9d..8f0626a6244 100644 --- a/composer.json +++ b/composer.json @@ -121,7 +121,6 @@ "stubs/Doctrine/Common/Persistence/ObjectManager.php", "rules-tests/Transform/Rector/FuncCall/FuncCallToMethodCallRector/Source/some_view_function.php", "rules-tests/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector/Source/MyBar.php", - "rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php", "rules-tests/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector/Source/FunctionTyped.php" ] }, diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/AutoImportTest.php b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/AutoImportTest.php deleted file mode 100644 index b5ab4c36931..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/AutoImportTest.php +++ /dev/null @@ -1,36 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureAutoImport'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/auto_import.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/CompleteVarDocTypePropertyRectorTest.php b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/CompleteVarDocTypePropertyRectorTest.php deleted file mode 100644 index 3f04333768a..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/CompleteVarDocTypePropertyRectorTest.php +++ /dev/null @@ -1,36 +0,0 @@ -doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/assign_conflict.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/assign_conflict.php.inc deleted file mode 100644 index 191b53dfa1d..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/assign_conflict.php.inc +++ /dev/null @@ -1,54 +0,0 @@ -eventDispatcher = $eventDispatcher; - } - - public function run(Robocop $stdClass) - { - $this->eventDispatcher = $stdClass; - } -} - -?> ------ -eventDispatcher = $eventDispatcher; - } - - public function run(Robocop $stdClass) - { - $this->eventDispatcher = $stdClass; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value.php.inc deleted file mode 100644 index 873027a7c9a..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value.php.inc +++ /dev/null @@ -1,45 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value_array_mixed.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value_array_mixed.php.inc deleted file mode 100644 index 955850a653e..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/default_value_array_mixed.php.inc +++ /dev/null @@ -1,24 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/improve_type_and_keep_comment.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/improve_type_and_keep_comment.php.inc deleted file mode 100644 index c56e5676901..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/improve_type_and_keep_comment.php.inc +++ /dev/null @@ -1,43 +0,0 @@ -ids[] = 'hello'; - if (random_int(1, 100)) { - $this->ids = 'hey'; - } - } -} - -?> ------ -ids[] = 'hello'; - if (random_int(1, 100)) { - $this->ids = 'hey'; - } - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/object_cast_to_stdclass.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/object_cast_to_stdclass.php.inc deleted file mode 100644 index e3925a6376b..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/object_cast_to_stdclass.php.inc +++ /dev/null @@ -1,37 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/private_var_null_unused.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/private_var_null_unused.php.inc deleted file mode 100644 index f38550b9cff..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/private_var_null_unused.php.inc +++ /dev/null @@ -1,24 +0,0 @@ - ------ - diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/property_assign.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/property_assign.php.inc deleted file mode 100644 index 9874005a801..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/property_assign.php.inc +++ /dev/null @@ -1,34 +0,0 @@ -eventDispatcher = $eventDispatcher; - } -} - -?> ------ -eventDispatcher = $eventDispatcher; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/public_var_null_used.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/public_var_null_used.php.inc deleted file mode 100644 index c264a7dbf33..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/public_var_null_used.php.inc +++ /dev/null @@ -1,38 +0,0 @@ -config = new stdClass; - } -} - -?> ------ -config = new stdClass; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/recursive_multiple_class_string_array.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/recursive_multiple_class_string_array.php.inc deleted file mode 100644 index 38dd3cccd51..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/recursive_multiple_class_string_array.php.inc +++ /dev/null @@ -1,60 +0,0 @@ - [ - InvokableA::class, - InvokableB::class, - InvokableC::class, - ], - 'factories' => [ - FactoryA::class, - FactoryB::class, - FactoryC::class, - ], - ]; -} - -?> ------ - - */ - public $services = [ - 'invokables' => [ - InvokableA::class, - InvokableB::class, - InvokableC::class, - ], - 'factories' => [ - FactoryA::class, - FactoryB::class, - FactoryC::class, - ], - ]; -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_already_used.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_already_used.php.inc deleted file mode 100644 index cb2772acf3a..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_already_used.php.inc +++ /dev/null @@ -1,18 +0,0 @@ -signalSlotDispatcher = $signalSlotDispatcher; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_more_specific.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_more_specific.php.inc deleted file mode 100644 index 2b2e272bc03..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_more_specific.php.inc +++ /dev/null @@ -1,29 +0,0 @@ -getLabel()] = $service; - } - - /** - * @return SomeService[] - */ - public static function getRegisteredSomeServices() - { - return self::$registry; - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_multiple_class_string_array.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_multiple_class_string_array.php.inc deleted file mode 100644 index 37eecc078cf..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_multiple_class_string_array.php.inc +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_public_var_null_unused.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_public_var_null_unused.php.inc deleted file mode 100644 index 340476bc267..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/skip_public_var_null_unused.php.inc +++ /dev/null @@ -1,8 +0,0 @@ -getClosureThis()) { - $code = \Closure::bind($code, $this); - } - } - $this->code = $code; - return $this; - } -} - -?> ------ -getClosureThis()) { - $code = \Closure::bind($code, $this); - } - } - $this->code = $code; - return $this; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_command_defined_in_constructor.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_command_defined_in_constructor.php.inc deleted file mode 100644 index c0a4469207b..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_command_defined_in_constructor.php.inc +++ /dev/null @@ -1,62 +0,0 @@ -definition = new InputDefinition(); - } - - /** - * @param array|InputDefinition $definition An array of argument and option instances or a definition instance - */ - public function setDefinition($definition) - { - if ($definition instanceof InputDefinition) { - $this->definition = $definition; - } else { - $this->definition->setDefinition($definition); - } - } -} - -?> ------ -definition = new InputDefinition(); - } - - /** - * @param array|InputDefinition $definition An array of argument and option instances or a definition instance - */ - public function setDefinition($definition) - { - if ($definition instanceof InputDefinition) { - $this->definition = $definition; - } else { - $this->definition->setDefinition($definition); - } - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_helper_set.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_helper_set.php.inc deleted file mode 100644 index 455e53e3174..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/symfony_console_helper_set.php.inc +++ /dev/null @@ -1,76 +0,0 @@ -application = $application; - if ($application) { - $this->setHelperSet($application->getHelperSet()); - } else { - $this->helperSet = null; - } - } - - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * @return HelperSet - */ - public function getHelperSet() - { - return $this->helperSet; - } -} - -?> ------ -application = $application; - if ($application) { - $this->setHelperSet($application->getHelperSet()); - } else { - $this->helperSet = null; - } - } - - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * @return HelperSet - */ - public function getHelperSet() - { - return $this->helperSet; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array.php.inc deleted file mode 100644 index eeb893793f7..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array.php.inc +++ /dev/null @@ -1,40 +0,0 @@ -items = $items; - } -} - -?> ------ -items = $items; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array_nested.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array_nested.php.inc deleted file mode 100644 index 85d0d0d663a..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/typed_array_nested.php.inc +++ /dev/null @@ -1,40 +0,0 @@ -itemsNested = $itemsNested; - } -} - -?> ------ -itemsNested = $itemsNested; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/with_numeric_check.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/with_numeric_check.php.inc deleted file mode 100644 index 76917dc8ae7..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Fixture/with_numeric_check.php.inc +++ /dev/null @@ -1,47 +0,0 @@ -value = $value; - return; - } - - $this->value = 100; - } -} - -?> ------ -value = $value; - return; - } - - $this->value = 100; - } -} - -?> diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/FixtureAutoImport/keep_simple_class.php.inc b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/FixtureAutoImport/keep_simple_class.php.inc deleted file mode 100644 index 6a7a06e0bbe..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/FixtureAutoImport/keep_simple_class.php.inc +++ /dev/null @@ -1,18 +0,0 @@ -obj = new stdClass(); - } -} diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php deleted file mode 100644 index 89a90ed8177..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php +++ /dev/null @@ -1,8 +0,0 @@ -parameters(); - $parameters->set(Option::AUTO_IMPORT_NAMES, true); - - $services = $containerConfigurator->services(); - $services->set(CompleteVarDocTypePropertyRector::class); -}; diff --git a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/config/configured_rule.php b/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/config/configured_rule.php deleted file mode 100644 index 198e93cd9a3..00000000000 --- a/rules-tests/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector/config/configured_rule.php +++ /dev/null @@ -1,11 +0,0 @@ -services(); - $services->set(CompleteVarDocTypePropertyRector::class); -}; diff --git a/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php b/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php deleted file mode 100644 index ccc3900e509..00000000000 --- a/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php +++ /dev/null @@ -1,92 +0,0 @@ -eventDispatcher = $eventDispatcher; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - /** - * @var EventDispatcher - */ - private $eventDispatcher; - - public function __construct(EventDispatcher $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } -} -CODE_SAMPLE - ), - ] - ); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [Property::class]; - } - - /** - * @param Property $node - */ - public function refactor(Node $node): ?Node - { - $propertyType = $this->propertyTypeInferer->inferProperty($node); - if ($propertyType instanceof MixedType) { - return null; - } - - if (! $node->isPrivate() && $propertyType instanceof NullType) { - return null; - } - - $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); - $this->phpDocTypeChanger->changeVarType($phpDocInfo, $propertyType); - - return $node; - } -}