From 867e9441efb4eeb8b12ce66d51a332a7885849ad Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 2 Mar 2023 15:27:05 +0000 Subject: [PATCH] Updated Rector to commit efc969e6411704d02e004045cb8b1da5d263970c https://github.com/rectorphp/rector-src/commit/efc969e6411704d02e004045cb8b1da5d263970c Improve setup-ci command with helper links and allow override (#3438) --- src/Application/VersionResolver.php | 4 +-- src/Console/Command/SetupCICommand.php | 39 +++++++++++++++++--------- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++---- vendor/composer/autoload_static.php | 8 +++--- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 0c0acc00f3c..c454b81ef3a 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 = 'a7d45e469a134f8671749aaf4a9a5ea797394e3a'; + public const PACKAGE_VERSION = 'efc969e6411704d02e004045cb8b1da5d263970c'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-03-02 12:21:07'; + public const RELEASE_DATE = '2023-03-02 15:22:13'; /** * @var int */ diff --git a/src/Console/Command/SetupCICommand.php b/src/Console/Command/SetupCICommand.php index e3670077015..b51b8744647 100644 --- a/src/Console/Command/SetupCICommand.php +++ b/src/Console/Command/SetupCICommand.php @@ -41,22 +41,35 @@ final class SetupCICommand extends Command $this->symfonyStyle->error('No CI detected'); return self::FAILURE; } - if ($ci === CiDetector::CI_GITHUB_ACTIONS) { - $rectorWorkflowFilePath = \getcwd() . '/.github/workflows/rector.yaml'; - if (\file_exists($rectorWorkflowFilePath)) { - $this->symfonyStyle->warning('The "rector.yaml" workflow already exists'); + if ($ci !== CiDetector::CI_GITHUB_ACTIONS) { + $noteMessage = \sprintf('Only Github Action is supported for now.%sCreate an issue to add your CI %s', \PHP_EOL, 'https://github.com/rectorphp/rector/issues/'); + $this->symfonyStyle->note($noteMessage); + return self::SUCCESS; + } + $rectorWorkflowFilePath = \getcwd() . '/.github/workflows/rector.yaml'; + if (\file_exists($rectorWorkflowFilePath)) { + $response = $this->symfonyStyle->ask('The "rector.yaml" workflow already exists. Overwrite it?', 'Yes'); + if (!\in_array($response, ['y', 'yes', 'Yes'], \true)) { + $this->symfonyStyle->note('Nothing changed'); return self::SUCCESS; } - $currentRepository = $this->resolveCurrentRepositoryName(\getcwd()); - if ($currentRepository === null) { - $this->symfonyStyle->error('Current repository name could not be resolved'); - return self::FAILURE; - } - $workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml'); - $workflowContents = \strtr($workflowTemplate, ['__CURRENT_REPOSITORY__' => $currentRepository]); - FileSystem::write($rectorWorkflowFilePath, $workflowContents); - $this->symfonyStyle->success('The "rector.yaml" workflow was added'); } + $currentRepository = $this->resolveCurrentRepositoryName(\getcwd()); + if ($currentRepository === null) { + $this->symfonyStyle->error('Current repository name could not be resolved'); + return self::FAILURE; + } + $workflowTemplate = FileSystem::read(__DIR__ . '/../../../templates/rector-github-action-check.yaml'); + $workflowContents = \strtr($workflowTemplate, ['__CURRENT_REPOSITORY__' => $currentRepository]); + FileSystem::write($rectorWorkflowFilePath, $workflowContents); + $this->symfonyStyle->newLine(); + $this->symfonyStyle->note('The "rector.yaml" workflow was added'); + $this->symfonyStyle->newLine(); + $this->symfonyStyle->title('2 steps more to run you Github Action:'); + $this->symfonyStyle->writeln('1) Generate new Github Token here:' . \PHP_EOL . 'https://github.com/settings/tokens/new'); + $this->symfonyStyle->newLine(); + $this->symfonyStyle->writeln('2) Add it to your repository secrets under "GITHUB_TOKE" name:' . \PHP_EOL . \sprintf('https://github.com/%s/settings/secrets/actions/new', $currentRepository)); + $this->symfonyStyle->newLine(); return Command::SUCCESS; } /** diff --git a/vendor/autoload.php b/vendor/autoload.php index 0bbab7eca21..d5802f46987 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769::getLoader(); +return ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 45a9c6c3b6d..895cb5f2ac0 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769 +class ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInite4770c262ed48ac8d5798b18be9cb769', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit9823ecb4d7a2d3b55a3976916fa0bfb2', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index ec4edc7e7dd..a122e8693d5 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInite4770c262ed48ac8d5798b18be9cb769 +class ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3148,9 +3148,9 @@ class ComposerStaticInite4770c262ed48ac8d5798b18be9cb769 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInite4770c262ed48ac8d5798b18be9cb769::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit9823ecb4d7a2d3b55a3976916fa0bfb2::$classMap; }, null, ClassLoader::class); }