mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit fb18cc7970063c5a08351767e3af3a7461e34b5b
fb18cc7970
[dx] Show loaded composer based sets in case of --debug (#6435)
This commit is contained in:
parent
dc2c22a33a
commit
c4fafc51d3
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '373747cef4e013317763c78df56f370203e33d4b';
|
||||
public const PACKAGE_VERSION = 'fb18cc7970063c5a08351767e3af3a7461e34b5b';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-11-14 18:08:41';
|
||||
public const RELEASE_DATE = '2024-11-14 19:08:30';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\BetterPhpDocParser\PhpDocParser;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
|
||||
use Rector\BetterPhpDocParser\ValueObject\StartAndEnd;
|
||||
final class BetterTypeParser extends TypeParser
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory
|
||||
*/
|
||||
private $tokenIteratorFactory;
|
||||
public function __construct(TokenIteratorFactory $tokenIteratorFactory, ?ConstExprParser $constExprParser = null)
|
||||
{
|
||||
$this->tokenIteratorFactory = $tokenIteratorFactory;
|
||||
parent::__construct($constExprParser);
|
||||
}
|
||||
public function parse(TokenIterator $tokenIterator) : TypeNode
|
||||
{
|
||||
$betterTokenIterator = $this->tokenIteratorFactory->createFromTokenIterator($tokenIterator);
|
||||
$startPosition = $betterTokenIterator->currentPosition();
|
||||
$typeNode = parent::parse($betterTokenIterator);
|
||||
$endPosition = $betterTokenIterator->currentPosition();
|
||||
$startAndEnd = new StartAndEnd($startPosition, $endPosition);
|
||||
$typeNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd);
|
||||
return $typeNode;
|
||||
}
|
||||
}
|
@ -222,4 +222,10 @@ final class Option
|
||||
* @var string
|
||||
*/
|
||||
public const EDITOR_URL = 'editor_url';
|
||||
/**
|
||||
* @internal To report composer based loaded sets
|
||||
* @see \Rector\Configuration\RectorConfigBuilder::withComposerBased()
|
||||
* @var string
|
||||
*/
|
||||
public const COMPOSER_BASED_SETS = 'composer_based_sets';
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ use Rector\Config\Level\TypeDeclarationLevel;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Config\RegisteredService;
|
||||
use Rector\Configuration\Levels\LevelRulesResolver;
|
||||
use Rector\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Console\Notifier;
|
||||
use Rector\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Contract\Rector\RectorInterface;
|
||||
@ -197,6 +198,7 @@ final class RectorConfigBuilder
|
||||
if ($this->setGroups !== []) {
|
||||
$setManager = new SetManager(new SetProviderCollector(), new InstalledPackageResolver(\getcwd()));
|
||||
$this->groupLoadedSets = $setManager->matchBySetGroups($this->setGroups);
|
||||
SimpleParameterProvider::addParameter(\Rector\Configuration\Option::COMPOSER_BASED_SETS, $this->groupLoadedSets);
|
||||
}
|
||||
// merge sets together
|
||||
$this->sets = \array_merge($this->sets, $this->groupLoadedSets);
|
||||
|
@ -10,6 +10,7 @@ use Rector\ChangesReporting\Output\JsonOutputFormatter;
|
||||
use Rector\Configuration\ConfigInitializer;
|
||||
use Rector\Configuration\ConfigurationFactory;
|
||||
use Rector\Configuration\Option;
|
||||
use Rector\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Console\ExitCode;
|
||||
use Rector\Console\Output\OutputFormatterCollector;
|
||||
use Rector\Console\ProcessConfigureDecorator;
|
||||
@ -151,6 +152,10 @@ EOF
|
||||
$this->symfonyStyle->error(\sprintf('The following given path%s do%s not match any file%s or director%s: %s%s', $isSingular ? '' : 's', $isSingular ? 'es' : '', $isSingular ? '' : 's', $isSingular ? 'y' : 'ies', \PHP_EOL . \PHP_EOL . ' - ', \implode(\PHP_EOL . ' - ', $paths)));
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
// show debug info
|
||||
if ($configuration->isDebug()) {
|
||||
$this->reportLoadedComposerBasedSets();
|
||||
}
|
||||
// MAIN PHASE
|
||||
// 2. run Rector
|
||||
$processResult = $this->applicationFileProcessor->run($configuration, $input);
|
||||
@ -199,4 +204,16 @@ EOF
|
||||
}
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
private function reportLoadedComposerBasedSets() : void
|
||||
{
|
||||
if (!SimpleParameterProvider::hasParameter(Option::COMPOSER_BASED_SETS)) {
|
||||
return;
|
||||
}
|
||||
$composerBasedSets = SimpleParameterProvider::provideArrayParameter(Option::COMPOSER_BASED_SETS);
|
||||
if ($composerBasedSets === []) {
|
||||
return;
|
||||
}
|
||||
$this->symfonyStyle->writeln('[info] Sets loaded based on installed packages:');
|
||||
$this->symfonyStyle->listing($composerBasedSets);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ use Rector\BetterPhpDocParser\PhpDocNodeVisitor\TemplatePhpDocNodeVisitor;
|
||||
use Rector\BetterPhpDocParser\PhpDocNodeVisitor\UnionTypeNodePhpDocNodeVisitor;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\ArrayItemClassNameDecorator;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\BetterTypeParser;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\ConstExprClassNameDecorator;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\DoctrineAnnotationDecorator;
|
||||
use Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser;
|
||||
@ -265,7 +264,6 @@ final class LazyContainerFactory
|
||||
// phpdoc-parser
|
||||
$rectorConfig->when(TypeParser::class)->needs('$usedAttributes')->give(['lines' => \true, 'indexes' => \true]);
|
||||
$rectorConfig->when(ConstExprParser::class)->needs('$usedAttributes')->give(['lines' => \true, 'indexes' => \true]);
|
||||
$rectorConfig->alias(TypeParser::class, BetterTypeParser::class);
|
||||
$rectorConfig->when(RectorNodeTraverser::class)->needs('$rectors')->giveTagged(RectorInterface::class);
|
||||
$rectorConfig->when(ConfigInitializer::class)->needs('$rectors')->giveTagged(RectorInterface::class);
|
||||
$rectorConfig->when(ClassNameImportSkipper::class)->needs('$classNameImportSkipVoters')->giveTagged(ClassNameImportSkipVoterInterface::class);
|
||||
|
@ -10,4 +10,6 @@ __PATHS__
|
||||
])
|
||||
// uncomment to reach your current PHP version
|
||||
// ->withPhpSets()
|
||||
->withTypeCoverageLevel(0);
|
||||
->withTypeCoverageLevel(0)
|
||||
->withDeadCodeLevel(0)
|
||||
->withCodeQualityLevel(0);
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -1032,7 +1032,6 @@ return array(
|
||||
'Rector\\BetterPhpDocParser\\PhpDocNodeVisitor\\UnionTypeNodePhpDocNodeVisitor' => $baseDir . '/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ArrayItemClassNameDecorator' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\BetterTypeParser' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/BetterTypeParser.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ClassAnnotationMatcher' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ConstExprClassNameDecorator' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\DoctrineAnnotationDecorator' => $baseDir . '/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php',
|
||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -1251,7 +1251,6 @@ class ComposerStaticInit58d677395c7d7c6a1b0f093c876515de
|
||||
'Rector\\BetterPhpDocParser\\PhpDocNodeVisitor\\UnionTypeNodePhpDocNodeVisitor' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ArrayItemClassNameDecorator' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\BetterTypeParser' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/BetterTypeParser.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ClassAnnotationMatcher' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\ConstExprClassNameDecorator' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php',
|
||||
'Rector\\BetterPhpDocParser\\PhpDocParser\\DoctrineAnnotationDecorator' => __DIR__ . '/../..' . '/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php',
|
||||
|
Loading…
x
Reference in New Issue
Block a user