From 09251da5973e0053db974d75f75c625a64f59506 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 12 Jun 2021 18:29:59 +0200 Subject: [PATCH] [Privatization] Skip abstract class in PrivatizeLocalPropertyToPrivatePropertyRector --- .../Fixture/include_abstract.php.inc | 21 ------------ .../Fixture/skip_abstract_class.php.inc | 8 +++++ .../skip_protected_abstract.php.inc | 8 ----- .../OpenSourceRectorTest.php | 33 ------------------- ...zeLocalPropertyToPrivatePropertyRector.php | 4 +-- 5 files changed, 10 insertions(+), 64 deletions(-) delete mode 100644 rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/include_abstract.php.inc create mode 100644 rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract_class.php.inc delete mode 100644 rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/FixtureOpenSource/skip_protected_abstract.php.inc delete mode 100644 rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/OpenSourceRectorTest.php diff --git a/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/include_abstract.php.inc b/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/include_abstract.php.inc deleted file mode 100644 index 2f6a9a0f8bf..00000000000 --- a/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/include_abstract.php.inc +++ /dev/null @@ -1,21 +0,0 @@ - ------ - diff --git a/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract_class.php.inc b/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract_class.php.inc new file mode 100644 index 00000000000..83a2737c5ef --- /dev/null +++ b/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract_class.php.inc @@ -0,0 +1,8 @@ +doTestFileInfo($fileInfo); - } - - /** - * @return Iterator - */ - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureOpenSource'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/fixture_open_source.php'; - } -} diff --git a/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php b/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php index e5be21a6881..5f625a69982 100644 --- a/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php +++ b/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php @@ -158,8 +158,8 @@ private function shouldSkipClass(ClassLike $classLike): bool return true; } - if (! $classLike->isAbstract()) { - return false; + if ($classLike->isAbstract()) { + return true; } return $this->isOpenSourceProjectType();