Skip to content

Commit

Permalink
Updated Rector to commit cecb60da20dfbe57e70ac43d606eba711aed4e8c
Browse files Browse the repository at this point in the history
rectorphp/rector-src@cecb60d [DX] Suggest to use withSets() when using multiple PHP version, eg both php 7.4 and 8.0 on CI on Notifier messages (#5991)
  • Loading branch information
TomasVotruba committed Jun 20, 2024
1 parent f4b3213 commit a75c607
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 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 = '891bfdaf9ea8d10341fe4a3c63c25aa8245de79b';
public const PACKAGE_VERSION = 'cecb60da20dfbe57e70ac43d606eba711aed4e8c';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-06-20 22:54:16';
public const RELEASE_DATE = '2024-06-21 00:15:57';
/**
* @var int
*/
Expand Down
20 changes: 10 additions & 10 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,55 +424,55 @@ public function withPhpSets(bool $php83 = \false, bool $php82 = \false, bool $ph
// suitable for PHP 7.4 and lower, before named args
public function withPhp53Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_53;
return $this;
}
public function withPhp54Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_54;
return $this;
}
public function withPhp55Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_55;
return $this;
}
public function withPhp56Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_56;
return $this;
}
public function withPhp70Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_70;
return $this;
}
public function withPhp71Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_71;
return $this;
}
public function withPhp72Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_72;
return $this;
}
public function withPhp73Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_73;
return $this;
}
public function withPhp74Sets() : self
{
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__, 'withPhpSets');
Notifier::notifyNotSuitableMethodForPHP80(__METHOD__);
$this->sets[] = LevelSetList::UP_TO_PHP_74;
return $this;
}
Expand Down Expand Up @@ -502,7 +502,7 @@ public function withPreparedSets(
bool $twig = \false
) : self
{
Notifier::notifyNotSuitableMethodForPHP74(__METHOD__, 'withSets');
Notifier::notifyNotSuitableMethodForPHP74(__METHOD__);
if ($deadCode) {
$this->sets[] = SetList::DEAD_CODE;
}
Expand Down
16 changes: 11 additions & 5 deletions src/Console/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@
use RectorPrefix202406\Symfony\Component\Console\Style\SymfonyStyle;
final class Notifier
{
public static function notifyNotSuitableMethodForPHP74(string $calledMethod, string $recommendedMethod) : void
public static function notifyNotSuitableMethodForPHP74(string $calledMethod) : void
{
if (\PHP_VERSION_ID >= 80000) {
return;
}
$message = \sprintf('The "%s()" method uses named arguments. Its suitable for PHP 8.0+. In lower PHP versions, use "%s()" method instead', $calledMethod, $recommendedMethod);
$message = \sprintf('The "%s()" method uses named arguments. Its suitable for PHP 8.0+. In lower PHP versions, use "withSets([...])" method instead', $calledMethod);
$symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput());
$symfonyStyle->warning($message);
\sleep(3);
}
public static function notifyNotSuitableMethodForPHP80(string $calledMethod, string $recommendedMethod) : void
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 "%s()" method instead.', $calledMethod, $recommendedMethod);
$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);
Expand All @@ -34,7 +37,10 @@ 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);
$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+.';
$symfonyStyle = new SymfonyStyle(new ArgvInput(), new ConsoleOutput());
$symfonyStyle->warning($message);
\sleep(3);
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1869,12 +1869,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "a8fd1d96561cf762cfa52f35e065ead1d5d5fbd3"
"reference": "bc038d9038168c834a21aadbfd91575c0d4f44d6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/a8fd1d96561cf762cfa52f35e065ead1d5d5fbd3",
"reference": "a8fd1d96561cf762cfa52f35e065ead1d5d5fbd3",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/bc038d9038168c834a21aadbfd91575c0d4f44d6",
"reference": "bc038d9038168c834a21aadbfd91575c0d4f44d6",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -1904,7 +1904,7 @@
"tomasvotruba\/class-leak": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2024-06-20T15:36:51+00:00",
"time": "2024-06-20T16:02:40+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c3c91df'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a16ded4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e23a9b5'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main a8fd1d9'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c3c91df'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a16ded4'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e23a9b5'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main bc038d9'));
private function __construct()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

use Rector\Set\Contract\SetInterface;
use Rector\Set\Contract\SetProviderInterface;
use Rector\Set\ValueObject\ComposerTriggeredSet;
use Rector\Symfony\Set\TwigSetList;
final class TwigSetProvider implements SetProviderInterface
{
/**
* @return SetInterface[]
*/
public function provide() : array
{
// @todo fill
return [];
return [new ComposerTriggeredSet('twig', 'twig/twig', '1.12', TwigSetList::TWIG_112), new ComposerTriggeredSet('twig', 'twig/twig', '1.27', TwigSetList::TWIG_127), new ComposerTriggeredSet('twig', 'twig/twig', '1.34', TwigSetList::TWIG_134), new ComposerTriggeredSet('twig', 'twig/twig', '1.40', TwigSetList::TWIG_140), new ComposerTriggeredSet('twig', 'twig/twig', '2.0', TwigSetList::TWIG_20), new ComposerTriggeredSet('twig', 'twig/twig', '2.40', TwigSetList::TWIG_240)];
}
}

0 comments on commit a75c607

Please sign in to comment.