Skip to content

Commit

Permalink
Updated Rector to commit 07dc58043d4a4634e6376094af98a3233719a2da
Browse files Browse the repository at this point in the history
rectorphp/rector-src@07dc580 Run with*Sets() notifications only on PHP 8.0 to avoid true/false/false/true configs (#5993)
  • Loading branch information
TomasVotruba committed Jun 21, 2024
1 parent 1951a60 commit d5a6bce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 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 = '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
*/
Expand Down
14 changes: 4 additions & 10 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
19 changes: 1 addition & 18 deletions src/Console/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d5a6bce

Please sign in to comment.