diff --git a/rector.php b/rector.php index fda67e23fa8..b095ee50e63 100644 --- a/rector.php +++ b/rector.php @@ -17,7 +17,6 @@ typeDeclarations: true, typeDeclarationDocblocks: true, privatization: true, - naming: true, instanceOf: true, earlyReturn: true, rectorPreset: true, diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 3e85220adf4..622a72fc529 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -641,6 +641,7 @@ public function withPhp74Sets(): self // as we already use PHP 8.0 and should go with withPhpSets() instead /** + * @param bool $naming @deprecated The naming set often causes conflicting variable and param names; use a coding standard tool instead * @param bool $instanceOf @deprecated Use $codeQuality instead, as most instanceof rules were moved there * @param bool $if @deprecated Use $codeQuality and $codingStyle instead, as the if rules were moved there or deprecated * @param bool $earlyReturn @deprecated Use $codeQuality instead, as all early return rules were moved there @@ -668,6 +669,10 @@ public function withPreparedSets( ): self { Notifier::notifyNotSuitableMethodForPHP74(__METHOD__); + if ($naming) { + Notifier::notifyDeprecatedNamingSet(); + } + $setMap = [ SetList::DEAD_CODE => $deadCode, SetList::CODE_QUALITY => $codeQuality, diff --git a/src/Console/Notifier.php b/src/Console/Notifier.php index 06539f12f5b..347c3505f17 100644 --- a/src/Console/Notifier.php +++ b/src/Console/Notifier.php @@ -40,6 +40,15 @@ public static function notifyDeprecatedPhpSet(string $set): void $symfonyStyle->warning($message); } + public static function notifyDeprecatedNamingSet(): void + { + $message = 'The "naming" prepared set is deprecated, as it often causes conflicting variable and param names and removes context. ' + . 'Renaming to match types belongs to a coding standard tool rather than Rector.'; + + $symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput()); + $symfonyStyle->warning($message); + } + public static function errorWithPhpSetsNotSuitableForPHP74AndLower(): void { if (PHP_VERSION_ID >= 80000) {