diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 951e894d57f..0f7577cc13a 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -510,75 +510,60 @@ public function withPhpSets( return $this; } - // suitable for PHP 7.4 and lower, before named args + /** + * Following methods are suitable for PHP 7.4 and lower, before named args + * Let's keep them without warning, in case Rector is run on both PHP 7.4 and PHP 8.0 in CI + */ public function withPhp53Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_53; return $this; } public function withPhp54Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_54; return $this; } public function withPhp55Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_55; return $this; } public function withPhp56Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_56; return $this; } public function withPhp70Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_70; return $this; } public function withPhp71Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_71; return $this; } public function withPhp72Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_72; return $this; } public function withPhp73Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_73; return $this; } public function withPhp74Sets(): self { - Notifier::notifyNotSuitableMethodForPHP80(__METHOD__); - $this->sets[] = LevelSetList::UP_TO_PHP_74; return $this; } diff --git a/src/Console/Notifier.php b/src/Console/Notifier.php index 972439534c6..868280ccaf7 100644 --- a/src/Console/Notifier.php +++ b/src/Console/Notifier.php @@ -27,37 +27,13 @@ public static function notifyNotSuitableMethodForPHP74(string $calledMethod): vo sleep(3); } - public static function notifyNotSuitableMethodForPHP80(string $calledMethod): void - { - // current project version check - if (PHP_VERSION_ID < 80000) { - return; - } - - $message = sprintf( - 'The "%s()" method is suitable for PHP 7.4 and lower. Use the following methods instead: - - - "withPhpSets()" in PHP 8.0+ - - "withSets([...])" for use in both php ^7.2 and php 8.0+.', - $calledMethod - ); - - $symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput()); - $symfonyStyle->warning($message); - - sleep(3); - } - public static function notifyWithPhpSetsNotSuitableForPHP80(): void { if (PHP_VERSION_ID >= 80000) { return; } - $message = 'The "withPhpSets()" method uses named arguments. Its suitable for PHP 8.0+. Use the following methods instead: - - - "withPhp53Sets()" ... "withPhp74Sets()" in lower PHP versions - - "withSets([...])" for use both PHP ^7.2 and php 8.0+.'; + $message = 'The "withPhpSets()" method uses named arguments. Its suitable for PHP 8.0+. Use more explicit "withPhp53Sets()" ... "withPhp74Sets()" in lower PHP versions instead.'; $symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput()); $symfonyStyle->warning($message);