Skip to content

Commit

Permalink
Updated Rector to commit f366a7e66228f35dc877e816b553c4f38332f801
Browse files Browse the repository at this point in the history
rectorphp/rector-src@f366a7e [DX] add notifyWithPhpSetsNotSuitableForPHP80() (#5988)
  • Loading branch information
TomasVotruba committed Jun 20, 2024
1 parent 8453ac2 commit 14cd108
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
5 changes: 2 additions & 3 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 10 additions & 0 deletions src/Console/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 14cd108

Please sign in to comment.