From 14cd1082cf73d4679b3b84a36577fedb83f65441 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 20 Jun 2024 13:25:20 +0000 Subject: [PATCH] Updated Rector to commit f366a7e66228f35dc877e816b553c4f38332f801 https://github.com/rectorphp/rector-src/commit/f366a7e66228f35dc877e816b553c4f38332f801 [DX] add notifyWithPhpSetsNotSuitableForPHP80() (#5988) --- src/Application/VersionResolver.php | 4 ++-- src/Configuration/RectorConfigBuilder.php | 5 ++--- src/Console/Notifier.php | 10 ++++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 1bd4b8d609c..0590a8f7d10 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 = 'afdf525d46e29655076253ec8d35e780cadd1be2'; + public const PACKAGE_VERSION = 'f366a7e66228f35dc877e816b553c4f38332f801'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-06-20 15:17:54'; + public const RELEASE_DATE = '2024-06-20 13:21:54'; /** * @var int */ diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index d7e148df688..8b2f16b45b6 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -346,9 +346,8 @@ public function withPhpPolyfill() : self public function withPhpSets(bool $php83 = \false, bool $php82 = \false, bool $php81 = \false, bool $php80 = \false, bool $php74 = \false, bool $php73 = \false, bool $php72 = \false, bool $php71 = \false, bool $php70 = \false, bool $php56 = \false, bool $php55 = \false, bool $php54 = \false, bool $php53 = \false, bool $php84 = \false) : self { $pickedArguments = \array_filter(\func_get_args()); - if ($pickedArguments !== [] && \PHP_VERSION_ID < 80000) { - echo \sprintf('The "withPhpSets()" method uses named arguments. Its suitable for PHP 8.0+. In lower PHP versions, use withPhp53Sets() ... withPhp74Sets() method instead. One at a time.%sTo use your composer.json PHP version, keep arguments of this method.', \PHP_EOL); - \sleep(3); + if ($pickedArguments !== []) { + Notifier::notifyWithPhpSetsNotSuitableForPHP80(); } if (\count($pickedArguments) > 1) { throw new InvalidConfigurationException(\sprintf('Pick only one version target in "withPhpSets()". All rules up to this version will be used.%sTo use your composer.json PHP version, keep arguments empty.', \PHP_EOL)); diff --git a/src/Console/Notifier.php b/src/Console/Notifier.php index 17f84768727..a79f502d532 100644 --- a/src/Console/Notifier.php +++ b/src/Console/Notifier.php @@ -29,4 +29,14 @@ public static function notifyNotSuitableMethodForPHP80(string $calledMethod, str $symfonyStyle->warning($message); \sleep(3); } + public static function notifyWithPhpSetsNotSuitableForPHP80() : void + { + if (\PHP_VERSION_ID >= 80000) { + return; + } + $message = \sprintf('The "withPhpSets()" method uses named arguments. Its suitable for PHP 8.0+. In lower PHP versions, use withPhp53Sets() ... withPhp74Sets() method instead. One at a time.%sTo use your composer.json PHP version, keep arguments of this method.', \PHP_EOL); + $symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput()); + $symfonyStyle->warning($message); + \sleep(3); + } }