diff --git a/rules-tests/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector/Fixture/skip_symfony_command_default_description.php.inc b/rules-tests/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector/Fixture/skip_symfony_command_default_description.php.inc new file mode 100644 index 00000000000..3f93e8d27a6 --- /dev/null +++ b/rules-tests/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector/Fixture/skip_symfony_command_default_description.php.inc @@ -0,0 +1,10 @@ +isSymfonyCommandReservedProperty($classReflection, $propertyName)) { + return false; + } + $parentClassName = $this->classReflectionAnalyzer->resolveParentClassName($classReflection); if ($parentClassName === null) { return true; @@ -65,6 +78,15 @@ public function isLegal(Property|string $property, ?ClassReflection $classReflec return $this->isGuardedByParents($parentClassReflections, $propertyName, $className); } + private function isSymfonyCommandReservedProperty(ClassReflection $classReflection, string $propertyName): bool + { + if (! in_array($propertyName, self::SYMFONY_COMMAND_RESERVED_PROPERTY_NAMES, true)) { + return false; + } + + return $classReflection->is('Symfony\Component\Console\Command\Command'); + } + private function isFoundInParentClassMethods( ClassReflection $parentClassReflection, string $propertyName,