mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 86eb0dd3632cac7e97fc21c3f59f0e80d6a9d579
86eb0dd363
[DX] Remove different php version rector reporting to make run more clean (#1959)
This commit is contained in:
parent
c770707831
commit
39f74c2f08
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\VersionBonding\Application;
|
||||
|
||||
use RectorPrefix20220324\Nette\Utils\Strings;
|
||||
use PHPStan\Php\PhpVersion;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
final class MissedRectorDueVersionChecker
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Contract\Console\OutputStyleInterface
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
public function __construct(\Rector\Core\Php\PhpVersionProvider $phpVersionProvider, \Rector\Core\Contract\Console\OutputStyleInterface $rectorOutputStyle)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
}
|
||||
/**
|
||||
* @param RectorInterface[] $rectors
|
||||
*/
|
||||
public function check(array $rectors) : void
|
||||
{
|
||||
$minProjectPhpVersion = $this->phpVersionProvider->provide();
|
||||
$missedRectors = $this->resolveMissedRectors($rectors, $minProjectPhpVersion);
|
||||
if ($missedRectors === []) {
|
||||
return;
|
||||
}
|
||||
$this->reportWarningMessage($minProjectPhpVersion, $missedRectors);
|
||||
$this->reportMissedRectors($missedRectors);
|
||||
$solutionMessage = \sprintf('Do you want to run them? Make "require" > "php" in `composer.json` higher,%sor add "Option::PHP_VERSION_FEATURES" parameter to your `rector.php`.', \PHP_EOL);
|
||||
$this->rectorOutputStyle->note($solutionMessage);
|
||||
}
|
||||
/**
|
||||
* @param RectorInterface[] $rectors
|
||||
* @return MinPhpVersionInterface[]
|
||||
*/
|
||||
private function resolveMissedRectors(array $rectors, int $minProjectPhpVersion) : array
|
||||
{
|
||||
$missedRectors = [];
|
||||
foreach ($rectors as $rector) {
|
||||
if (!$rector instanceof \Rector\VersionBonding\Contract\MinPhpVersionInterface) {
|
||||
continue;
|
||||
}
|
||||
// the conditions are met → skip it
|
||||
if ($rector->provideMinPhpVersion() <= $minProjectPhpVersion) {
|
||||
continue;
|
||||
}
|
||||
$missedRectors[] = $rector;
|
||||
}
|
||||
return $missedRectors;
|
||||
}
|
||||
/**
|
||||
* @param MinPhpVersionInterface[] $minPhpVersions
|
||||
*/
|
||||
private function reportMissedRectors(array $minPhpVersions) : void
|
||||
{
|
||||
if (!$this->rectorOutputStyle->isVerbose()) {
|
||||
return;
|
||||
}
|
||||
foreach ($minPhpVersions as $minPhpVersion) {
|
||||
$phpVersion = new \PHPStan\Php\PhpVersion($minPhpVersion->provideMinPhpVersion());
|
||||
$shortRectorClass = \RectorPrefix20220324\Nette\Utils\Strings::after(\get_class($minPhpVersion), '\\', -1);
|
||||
$rectorMessage = \sprintf(' * [%s] %s', $phpVersion->getVersionString(), $shortRectorClass);
|
||||
$this->rectorOutputStyle->writeln($rectorMessage);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param MinPhpVersionInterface[] $missedRectors
|
||||
*/
|
||||
private function reportWarningMessage(int $minProjectPhpVersion, array $missedRectors) : void
|
||||
{
|
||||
$phpVersion = new \PHPStan\Php\PhpVersion($minProjectPhpVersion);
|
||||
$warningMessage = \sprintf('Your project requires min PHP version "%s". %s%d Rector rules defined in your configuration require higher PHP version and will not run,%sto avoid breaking your codebase, use -vvv for detailed info.', $phpVersion->getVersionString(), \PHP_EOL . \PHP_EOL, \count($missedRectors), \PHP_EOL);
|
||||
$this->rectorOutputStyle->warning($warningMessage);
|
||||
}
|
||||
}
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '278cd56de5cb1b18ee7162dee6340a6c72689dc1';
|
||||
public const PACKAGE_VERSION = '86eb0dd3632cac7e97fc21c3f59f0e80d6a9d579';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-03-24 22:17:08';
|
||||
public const RELEASE_DATE = '2022-03-25 00:39:44';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220324\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -11,7 +11,6 @@ use Rector\Core\Autoloading\BootstrapFilesIncluder;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\Output\OutputFormatterCollector;
|
||||
use Rector\Core\Contract\Console\OutputStyleInterface;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Reporting\MissingRectorRulesReporter;
|
||||
use Rector\Core\StaticReflection\DynamicSourceLocatorDecorator;
|
||||
@ -20,7 +19,6 @@ use Rector\Core\Validation\EmptyConfigurableRectorChecker;
|
||||
use Rector\Core\ValueObject\Configuration;
|
||||
use Rector\Core\ValueObject\ProcessResult;
|
||||
use Rector\Core\ValueObjectFactory\ProcessResultFactory;
|
||||
use Rector\VersionBonding\Application\MissedRectorDueVersionChecker;
|
||||
use RectorPrefix20220324\Symfony\Component\Console\Application;
|
||||
use RectorPrefix20220324\Symfony\Component\Console\Command\Command;
|
||||
use RectorPrefix20220324\Symfony\Component\Console\Input\InputInterface;
|
||||
@ -63,11 +61,6 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
||||
* @var \Rector\Core\StaticReflection\DynamicSourceLocatorDecorator
|
||||
*/
|
||||
private $dynamicSourceLocatorDecorator;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\VersionBonding\Application\MissedRectorDueVersionChecker
|
||||
*/
|
||||
private $missedRectorDueVersionChecker;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Validation\EmptyConfigurableRectorChecker
|
||||
@ -88,15 +81,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
||||
* @var \Rector\Core\Util\MemoryLimiter
|
||||
*/
|
||||
private $memoryLimiter;
|
||||
/**
|
||||
* @var RectorInterface[]
|
||||
* @readonly
|
||||
*/
|
||||
private $rectors;
|
||||
/**
|
||||
* @param RectorInterface[] $rectors
|
||||
*/
|
||||
public function __construct(\Rector\Core\Autoloading\AdditionalAutoloader $additionalAutoloader, \Rector\Caching\Detector\ChangedFilesDetector $changedFilesDetector, \Rector\Core\Reporting\MissingRectorRulesReporter $missingRectorRulesReporter, \Rector\Core\Application\ApplicationFileProcessor $applicationFileProcessor, \Rector\Core\Autoloading\BootstrapFilesIncluder $bootstrapFilesIncluder, \Rector\Core\ValueObjectFactory\ProcessResultFactory $processResultFactory, \Rector\Core\StaticReflection\DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, \Rector\VersionBonding\Application\MissedRectorDueVersionChecker $missedRectorDueVersionChecker, \Rector\Core\Validation\EmptyConfigurableRectorChecker $emptyConfigurableRectorChecker, \Rector\Core\Console\Output\OutputFormatterCollector $outputFormatterCollector, \Rector\Core\Contract\Console\OutputStyleInterface $rectorOutputStyle, \Rector\Core\Util\MemoryLimiter $memoryLimiter, array $rectors)
|
||||
public function __construct(\Rector\Core\Autoloading\AdditionalAutoloader $additionalAutoloader, \Rector\Caching\Detector\ChangedFilesDetector $changedFilesDetector, \Rector\Core\Reporting\MissingRectorRulesReporter $missingRectorRulesReporter, \Rector\Core\Application\ApplicationFileProcessor $applicationFileProcessor, \Rector\Core\Autoloading\BootstrapFilesIncluder $bootstrapFilesIncluder, \Rector\Core\ValueObjectFactory\ProcessResultFactory $processResultFactory, \Rector\Core\StaticReflection\DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, \Rector\Core\Validation\EmptyConfigurableRectorChecker $emptyConfigurableRectorChecker, \Rector\Core\Console\Output\OutputFormatterCollector $outputFormatterCollector, \Rector\Core\Contract\Console\OutputStyleInterface $rectorOutputStyle, \Rector\Core\Util\MemoryLimiter $memoryLimiter)
|
||||
{
|
||||
$this->additionalAutoloader = $additionalAutoloader;
|
||||
$this->changedFilesDetector = $changedFilesDetector;
|
||||
@ -105,12 +90,10 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
||||
$this->bootstrapFilesIncluder = $bootstrapFilesIncluder;
|
||||
$this->processResultFactory = $processResultFactory;
|
||||
$this->dynamicSourceLocatorDecorator = $dynamicSourceLocatorDecorator;
|
||||
$this->missedRectorDueVersionChecker = $missedRectorDueVersionChecker;
|
||||
$this->emptyConfigurableRectorChecker = $emptyConfigurableRectorChecker;
|
||||
$this->outputFormatterCollector = $outputFormatterCollector;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->memoryLimiter = $memoryLimiter;
|
||||
$this->rectors = $rectors;
|
||||
parent::__construct();
|
||||
}
|
||||
protected function configure() : void
|
||||
@ -136,10 +119,8 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
||||
$this->additionalAutoloader->autoloadInput($input);
|
||||
$this->additionalAutoloader->autoloadPaths();
|
||||
$paths = $configuration->getPaths();
|
||||
// 0. add files and directories to static locator
|
||||
// 1. add files and directories to static locator
|
||||
$this->dynamicSourceLocatorDecorator->addPaths($paths);
|
||||
// 1. inform user about non-runnable rules
|
||||
$this->missedRectorDueVersionChecker->check($this->rectors);
|
||||
// 2. inform user about registering configurable rule without configuration
|
||||
$this->emptyConfigurableRectorChecker->check();
|
||||
// MAIN PHASE
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75::getLoader();
|
||||
return ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -3144,7 +3144,6 @@ return array(
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\PropertyTypeVendorLockResolver' => $baseDir . '/packages/VendorLocker/NodeVendorLocker/PropertyTypeVendorLockResolver.php',
|
||||
'Rector\\VendorLocker\\ParentClassMethodTypeOverrideGuard' => $baseDir . '/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php',
|
||||
'Rector\\VendorLocker\\VendorLockResolver' => $baseDir . '/packages/VendorLocker/VendorLockResolver.php',
|
||||
'Rector\\VersionBonding\\Application\\MissedRectorDueVersionChecker' => $baseDir . '/packages/VersionBonding/Application/MissedRectorDueVersionChecker.php',
|
||||
'Rector\\VersionBonding\\Contract\\MinPhpVersionInterface' => $baseDir . '/packages/VersionBonding/Contract/MinPhpVersionInterface.php',
|
||||
'Rector\\VersionBonding\\PhpVersionedFilter' => $baseDir . '/packages/VersionBonding/PhpVersionedFilter.php',
|
||||
'Rector\\Visibility\\Rector\\ClassConst\\ChangeConstantVisibilityRector' => $baseDir . '/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75
|
||||
class ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb8170b96e54ee553c1466953a0caec75::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireb8170b96e54ee553c1466953a0caec75($fileIdentifier, $file);
|
||||
composerRequirebe60b01d8e1fa746b68f8615e709d6ac($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequireb8170b96e54ee553c1466953a0caec75($fileIdentifier, $file)
|
||||
function composerRequirebe60b01d8e1fa746b68f8615e709d6ac($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitb8170b96e54ee553c1466953a0caec75
|
||||
class ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
@ -3513,7 +3513,6 @@ class ComposerStaticInitb8170b96e54ee553c1466953a0caec75
|
||||
'Rector\\VendorLocker\\NodeVendorLocker\\PropertyTypeVendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/NodeVendorLocker/PropertyTypeVendorLockResolver.php',
|
||||
'Rector\\VendorLocker\\ParentClassMethodTypeOverrideGuard' => __DIR__ . '/../..' . '/packages/VendorLocker/ParentClassMethodTypeOverrideGuard.php',
|
||||
'Rector\\VendorLocker\\VendorLockResolver' => __DIR__ . '/../..' . '/packages/VendorLocker/VendorLockResolver.php',
|
||||
'Rector\\VersionBonding\\Application\\MissedRectorDueVersionChecker' => __DIR__ . '/../..' . '/packages/VersionBonding/Application/MissedRectorDueVersionChecker.php',
|
||||
'Rector\\VersionBonding\\Contract\\MinPhpVersionInterface' => __DIR__ . '/../..' . '/packages/VersionBonding/Contract/MinPhpVersionInterface.php',
|
||||
'Rector\\VersionBonding\\PhpVersionedFilter' => __DIR__ . '/../..' . '/packages/VersionBonding/PhpVersionedFilter.php',
|
||||
'Rector\\Visibility\\Rector\\ClassConst\\ChangeConstantVisibilityRector' => __DIR__ . '/../..' . '/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php',
|
||||
@ -3838,9 +3837,9 @@ class ComposerStaticInitb8170b96e54ee553c1466953a0caec75
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb8170b96e54ee553c1466953a0caec75::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitbe60b01d8e1fa746b68f8615e709d6ac::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20220324\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false) && !interface_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false) && !trait_exists('ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75', false)) {
|
||||
spl_autoload_call('RectorPrefix20220324\ComposerAutoloaderInitb8170b96e54ee553c1466953a0caec75');
|
||||
if (!class_exists('ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac', false) && !interface_exists('ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac', false) && !trait_exists('ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac', false)) {
|
||||
spl_autoload_call('RectorPrefix20220324\ComposerAutoloaderInitbe60b01d8e1fa746b68f8615e709d6ac');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20220324\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220324\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequireb8170b96e54ee553c1466953a0caec75')) {
|
||||
function composerRequireb8170b96e54ee553c1466953a0caec75() {
|
||||
return \RectorPrefix20220324\composerRequireb8170b96e54ee553c1466953a0caec75(...func_get_args());
|
||||
if (!function_exists('composerRequirebe60b01d8e1fa746b68f8615e709d6ac')) {
|
||||
function composerRequirebe60b01d8e1fa746b68f8615e709d6ac() {
|
||||
return \RectorPrefix20220324\composerRequirebe60b01d8e1fa746b68f8615e709d6ac(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user