From d5a6bce33aef8693163e863b605c3a6e324710bb Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 21 Jun 2024 00:32:00 +0000 Subject: [PATCH] Updated Rector to commit 07dc58043d4a4634e6376094af98a3233719a2da https://github.com/rectorphp/rector-src/commit/07dc58043d4a4634e6376094af98a3233719a2da Run with*Sets() notifications only on PHP 8.0 to avoid true/false/false/true configs (#5993) --- src/Application/VersionResolver.php | 4 ++-- src/Configuration/RectorConfigBuilder.php | 14 ++++---------- src/Console/Notifier.php | 19 +------------------ 3 files changed, 7 insertions(+), 30 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index efb9a0ce7bb..3c277dca7b5 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '6b11f63e63fc75ea80a4ee609f3e175863305b6f'; + public const PACKAGE_VERSION = '07dc58043d4a4634e6376094af98a3233719a2da'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-06-21 02:25:42'; + public const RELEASE_DATE = '2024-06-21 02:28:40'; /** * @var int */ diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 12e1dbb3a9f..7c3bc435215 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -422,58 +422,52 @@ public function withPhpSets(bool $php83 = \false, bool $php82 = \false, bool $ph } 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 fe1f803cfd5..c4e2f2023c6 100644 --- a/src/Console/Notifier.php +++ b/src/Console/Notifier.php @@ -18,29 +18,12 @@ public static function notifyNotSuitableMethodForPHP74(string $calledMethod) : v $symfonyStyle->warning($message); \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); \sleep(3);