Updated Rector to commit 2a0cae5507

2a0cae5507 Make progress bar reflect number of processed files + process file by file in series (#362)
This commit is contained in:
Tomas Votruba 2021-07-02 20:55:14 +00:00
parent 1b48b9cb41
commit e3c7d5c703
58 changed files with 328 additions and 400 deletions

View File

@ -53,7 +53,7 @@ use RectorPrefix20210702\Symplify\SmartFileSystem\SmartFileSystem;
return static function (\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator) : void {
$services = $containerConfigurator->services();
$services->defaults()->public()->autowire()->autoconfigure();
$services->load('Rector\\Core\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/Exception', __DIR__ . '/../src/DependencyInjection/CompilerPass', __DIR__ . '/../src/DependencyInjection/Loader', __DIR__ . '/../src/HttpKernel', __DIR__ . '/../src/ValueObject', __DIR__ . '/../src/Bootstrap', __DIR__ . '/../src/PhpParser/Node/CustomNode', __DIR__ . '/../src/functions', __DIR__ . '/../src/constants.php', __DIR__ . '/../src/PhpParser/NodeVisitor/CreatedByRuleNodeVisitor.php']);
$services->load('Rector\\Core\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/Exception', __DIR__ . '/../src/DependencyInjection/CompilerPass', __DIR__ . '/../src/DependencyInjection/Loader', __DIR__ . '/../src/HttpKernel', __DIR__ . '/../src/ValueObject', __DIR__ . '/../src/Bootstrap', __DIR__ . '/../src/Enum', __DIR__ . '/../src/PhpParser/Node/CustomNode', __DIR__ . '/../src/functions', __DIR__ . '/../src/constants.php', __DIR__ . '/../src/PhpParser/NodeVisitor/CreatedByRuleNodeVisitor.php']);
$services->alias(\RectorPrefix20210702\Symfony\Component\Console\Application::class, \Rector\Core\Console\ConsoleApplication::class);
$services->set(\RectorPrefix20210702\Symplify\SmartFileSystem\FileSystemGuard::class);
$services->set(\RectorPrefix20210702\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser::class);

View File

@ -182,6 +182,14 @@ final class PhpDocInfo
{
return $this->getTypeOrMixed($this->getReturnTagValue());
}
/**
* @param class-string<TNode> $type
* @return TNode[]
*/
public function getByType(string $type) : array
{
return $this->phpDocNodeByTypeFinder->findByType($this->phpDocNode, $type);
}
/**
* @param class-string<TNode> $type
*/

View File

@ -93,8 +93,8 @@ final class StaticCallMethodCallTypeResolver implements \Rector\NodeTypeResolver
}
$methodReflection = $ancestorClassReflection->getMethod($methodName, $scope);
if ($methodReflection instanceof \PHPStan\Reflection\Php\PhpMethodReflection) {
$parametersAcceptor = \PHPStan\Reflection\ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
return $parametersAcceptor->getReturnType();
$parametersAcceptorWithPhpDocs = \PHPStan\Reflection\ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
return $parametersAcceptorWithPhpDocs->getReturnType();
}
}
return new \PHPStan\Type\MixedType();

View File

@ -34,17 +34,24 @@ final class ComposerFileProcessor implements \Rector\Core\Contract\Processor\Fil
$this->composerJsonPrinter = $composerJsonPrinter;
$this->composerRectors = $composerRectors;
}
/**
* @param File[] $files
*/
public function process(array $files, \Rector\Core\ValueObject\Configuration $configuration) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
if ($this->composerRectors === []) {
return;
}
foreach ($files as $file) {
$this->processFile($file);
// to avoid modification of file
$smartFileInfo = $file->getSmartFileInfo();
$composerJson = $this->composerJsonFactory->createFromFileInfo($smartFileInfo);
$oldComposerJson = clone $composerJson;
foreach ($this->composerRectors as $composerRector) {
$composerRector->refactor($composerJson);
}
// nothing has changed
if ($oldComposerJson->getJsonArray() === $composerJson->getJsonArray()) {
return;
}
$changeFileContent = $this->composerJsonPrinter->printToString($composerJson);
$file->changeFileContent($changeFileContent);
}
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
@ -61,22 +68,6 @@ final class ComposerFileProcessor implements \Rector\Core\Contract\Processor\Fil
{
return ['json'];
}
private function processFile(\Rector\Core\ValueObject\Application\File $file) : void
{
// to avoid modification of file
$smartFileInfo = $file->getSmartFileInfo();
$composerJson = $this->composerJsonFactory->createFromFileInfo($smartFileInfo);
$oldComposerJson = clone $composerJson;
foreach ($this->composerRectors as $composerRector) {
$composerRector->refactor($composerJson);
}
// nothing has changed
if ($oldComposerJson->getJsonArray() === $composerJson->getJsonArray()) {
return;
}
$changeFileContent = $this->composerJsonPrinter->printToString($composerJson);
$file->changeFileContent($changeFileContent);
}
private function isJsonInTests(\Symplify\SmartFileSystem\SmartFileInfo $fileInfo) : bool
{
if (!\Rector\Testing\PHPUnit\StaticPHPUnitEnvironment::isPHPUnitRun()) {

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
@ -22,6 +23,7 @@ use PhpParser\Node\Stmt\Return_;
use PHPStan\Type\ObjectType;
use PHPStan\Type\StringType;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -113,7 +115,8 @@ CODE_SAMPLE
*/
private function createAnonymousEventClassBody() : array
{
return [new \PhpParser\Node\Stmt\Property(\PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE, [new \PhpParser\Node\Stmt\PropertyProperty(self::NAME)]), new \PhpParser\Node\Stmt\ClassMethod('__construct', ['flags' => \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, 'params' => $this->createConstructParams(), self::STMTS => [new \PhpParser\Node\Stmt\Expression($this->createConstructAssign())]]), new \PhpParser\Node\Stmt\ClassMethod('eventName', ['flags' => \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, 'returnType' => 'string', self::STMTS => [new \PhpParser\Node\Stmt\Return_(new \PhpParser\Node\Expr\Variable('this->name'))]])];
$return = new \PhpParser\Node\Stmt\Return_(new \PhpParser\Node\Expr\PropertyFetch(new \PhpParser\Node\Expr\Variable('this'), 'name'));
return [new \PhpParser\Node\Stmt\Property(\PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE, [new \PhpParser\Node\Stmt\PropertyProperty(self::NAME)]), new \PhpParser\Node\Stmt\ClassMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT, ['flags' => \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, 'params' => $this->createConstructParams(), self::STMTS => [new \PhpParser\Node\Stmt\Expression($this->createConstructAssign())]]), new \PhpParser\Node\Stmt\ClassMethod('eventName', ['flags' => \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC, 'returnType' => 'string', self::STMTS => [$return]])];
}
/**
* @return Param[]
@ -124,6 +127,7 @@ CODE_SAMPLE
}
private function createConstructAssign() : \PhpParser\Node\Expr\Assign
{
return new \PhpParser\Node\Expr\Assign(new \PhpParser\Node\Expr\Variable('this->name'), new \PhpParser\Node\Expr\Variable(self::NAME));
$propertyFetch = new \PhpParser\Node\Expr\PropertyFetch(new \PhpParser\Node\Expr\Variable('this'), 'name');
return new \PhpParser\Node\Expr\Assign($propertyFetch, new \PhpParser\Node\Expr\Variable(self::NAME));
}
}

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@ final class AnnotationToAttributeRector extends \Rector\Core\Rector\AbstractRect
public const ANNOTATION_TO_ATTRIBUTE = 'annotation_to_attribute';
/**
* List of annotations that should not be unwrapped
* @var class-string[]
* @var string[]
*/
private const SKIP_UNWRAP_ANNOTATIONS = ['Symfony\\Component\\Validator\\Constraints\\All', 'Symfony\\Component\\Validator\\Constraints\\AtLeastOneOf', 'Symfony\\Component\\Validator\\Constraints\\Collection', 'Symfony\\Component\\Validator\\Constraints\\Sequentially'];
/**

View File

@ -9,6 +9,7 @@ use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\FileFormatter\FileFormatter;
use RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix20210702\Symplify\SmartFileSystem\SmartFileSystem;
final class ApplicationFileProcessor
{
@ -28,6 +29,10 @@ final class ApplicationFileProcessor
* @var \Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor
*/
private $removedAndAddedFilesProcessor;
/**
* @var \Symfony\Component\Console\Style\SymfonyStyle
*/
private $symfonyStyle;
/**
* @var mixed[]
*/
@ -35,12 +40,13 @@ final class ApplicationFileProcessor
/**
* @param FileProcessorInterface[] $fileProcessors
*/
public function __construct(\RectorPrefix20210702\Symplify\SmartFileSystem\SmartFileSystem $smartFileSystem, \Rector\Core\Application\FileDecorator\FileDiffFileDecorator $fileDiffFileDecorator, \Rector\FileFormatter\FileFormatter $fileFormatter, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor $removedAndAddedFilesProcessor, array $fileProcessors = [])
public function __construct(\RectorPrefix20210702\Symplify\SmartFileSystem\SmartFileSystem $smartFileSystem, \Rector\Core\Application\FileDecorator\FileDiffFileDecorator $fileDiffFileDecorator, \Rector\FileFormatter\FileFormatter $fileFormatter, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor $removedAndAddedFilesProcessor, \RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle $symfonyStyle, array $fileProcessors = [])
{
$this->smartFileSystem = $smartFileSystem;
$this->fileDiffFileDecorator = $fileDiffFileDecorator;
$this->fileFormatter = $fileFormatter;
$this->removedAndAddedFilesProcessor = $removedAndAddedFilesProcessor;
$this->symfonyStyle = $symfonyStyle;
$this->fileProcessors = $fileProcessors;
}
/**
@ -58,11 +64,21 @@ final class ApplicationFileProcessor
*/
private function processFiles(array $files, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($this->fileProcessors as $fileProcessor) {
$supportedFiles = \array_filter($files, function (\Rector\Core\ValueObject\Application\File $file) use($fileProcessor, $configuration) : bool {
return $fileProcessor->supports($file, $configuration);
});
$fileProcessor->process($supportedFiles, $configuration);
if ($configuration->shouldShowDiffs()) {
$fileCount = \count($files);
$this->symfonyStyle->progressStart($fileCount);
}
foreach ($files as $file) {
foreach ($this->fileProcessors as $fileProcessor) {
if (!$fileProcessor->supports($file, $configuration)) {
continue;
}
$fileProcessor->process($file, $configuration);
}
// progress bar +1
if ($configuration->shouldShowProgressBar()) {
$this->symfonyStyle->progressAdvance();
}
}
$this->removedAndAddedFilesProcessor->run($configuration);
}

View File

@ -9,6 +9,7 @@ use Rector\Core\Application\FileDecorator\FileDiffFileDecorator;
use Rector\Core\Application\FileProcessor;
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\Enum\ApplicationPhase;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\PhpParser\Printer\FormatPerservingPrinter;
use Rector\Core\Provider\CurrentFileProvider;
@ -17,23 +18,10 @@ use Rector\Core\ValueObject\Application\RectorError;
use Rector\Core\ValueObject\Configuration;
use Rector\PostRector\Application\PostFileProcessor;
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
use RectorPrefix20210702\Symfony\Component\Console\Helper\ProgressBar;
use RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix20210702\Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use Throwable;
final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* Why 4? One for each cycle, so user sees some activity all the time:
*
* 1) parsing files
* 2) main rectoring
* 3) post-rectoring (removing files, importing names)
* 4) printing
*
* @var int
*/
private const PROGRESS_BAR_STEP_MULTIPLIER = 4;
/**
* @var File[]
*/
@ -54,10 +42,6 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
* @var \Symfony\Component\Console\Style\SymfonyStyle
*/
private $symfonyStyle;
/**
* @var \Symplify\PackageBuilder\Reflection\PrivatesAccessor
*/
private $privatesAccessor;
/**
* @var \Rector\Core\Application\FileDecorator\FileDiffFileDecorator
*/
@ -74,60 +58,41 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
* @var \Rector\ChangesReporting\ValueObjectFactory\ErrorFactory
*/
private $errorFactory;
public function __construct(\Rector\Core\PhpParser\Printer\FormatPerservingPrinter $formatPerservingPrinter, \Rector\Core\Application\FileProcessor $fileProcessor, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector $removedAndAddedFilesCollector, \RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle $symfonyStyle, \RectorPrefix20210702\Symplify\PackageBuilder\Reflection\PrivatesAccessor $privatesAccessor, \Rector\Core\Application\FileDecorator\FileDiffFileDecorator $fileDiffFileDecorator, \Rector\Core\Provider\CurrentFileProvider $currentFileProvider, \Rector\PostRector\Application\PostFileProcessor $postFileProcessor, \Rector\ChangesReporting\ValueObjectFactory\ErrorFactory $errorFactory)
public function __construct(\Rector\Core\PhpParser\Printer\FormatPerservingPrinter $formatPerservingPrinter, \Rector\Core\Application\FileProcessor $fileProcessor, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector $removedAndAddedFilesCollector, \RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle $symfonyStyle, \Rector\Core\Application\FileDecorator\FileDiffFileDecorator $fileDiffFileDecorator, \Rector\Core\Provider\CurrentFileProvider $currentFileProvider, \Rector\PostRector\Application\PostFileProcessor $postFileProcessor, \Rector\ChangesReporting\ValueObjectFactory\ErrorFactory $errorFactory)
{
$this->formatPerservingPrinter = $formatPerservingPrinter;
$this->fileProcessor = $fileProcessor;
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector;
$this->symfonyStyle = $symfonyStyle;
$this->privatesAccessor = $privatesAccessor;
$this->fileDiffFileDecorator = $fileDiffFileDecorator;
$this->currentFileProvider = $currentFileProvider;
$this->postFileProcessor = $postFileProcessor;
$this->errorFactory = $errorFactory;
}
/**
* @param File[] $files
*/
public function process(array $files, \Rector\Core\ValueObject\Configuration $configuration) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
$fileCount = \count($files);
if ($fileCount === 0) {
// 1. parse files to nodes
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$this->fileProcessor->parseFileInfoToLocalCache($file);
}, \Rector\Core\Enum\ApplicationPhase::PARSING());
// 2. change nodes with Rectors
$this->refactorNodesWithRectors($file);
// 3. apply post rectors
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$newStmts = $this->postFileProcessor->traverse($file->getNewStmts());
// this is needed for new tokens added in "afterTraverse()"
$file->changeNewStmts($newStmts);
}, \Rector\Core\Enum\ApplicationPhase::POST_RECTORS());
// 4. print to file or string
$this->currentFileProvider->setFile($file);
if ($file->hasErrors()) {
// cannot print file with errors, as print would b
$this->notifyPhase($file, \Rector\Core\Enum\ApplicationPhase::PRINT_SKIP());
return;
}
$this->prepareProgressBar($fileCount, $configuration);
// 1. parse files to nodes
foreach ($files as $file) {
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$this->fileProcessor->parseFileInfoToLocalCache($file);
}, 'parsing', $configuration);
}
// 2. change nodes with Rectors
$this->refactorNodesWithRectors($files, $configuration);
// 3. apply post rectors
foreach ($files as $file) {
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$newStmts = $this->postFileProcessor->traverse($file->getNewStmts());
// this is needed for new tokens added in "afterTraverse()"
$file->changeNewStmts($newStmts);
}, 'post rectors', $configuration);
}
// 4. print to file or string
foreach ($files as $file) {
$this->currentFileProvider->setFile($file);
// cannot print file with errors, as print would break everything to original nodes
if ($file->hasErrors()) {
$this->printFileErrors($file);
$this->advance($file, 'printing skipped due error', $configuration);
continue;
}
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) use($configuration) : void {
$this->printFile($file, $configuration);
}, 'printing', $configuration);
}
if ($configuration->shouldShowProgressBar()) {
$this->symfonyStyle->newLine(2);
}
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) use($configuration) : void {
$this->printFile($file, $configuration);
}, \Rector\Core\Enum\ApplicationPhase::PRINT());
}
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
@ -141,32 +106,17 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
{
return ['php'];
}
private function prepareProgressBar(int $fileCount, \Rector\Core\ValueObject\Configuration $configuration) : void
{
if ($this->symfonyStyle->isVerbose()) {
return;
}
if (!$configuration->shouldShowProgressBar()) {
return;
}
$this->configureStepCount($fileCount);
}
/**
* @param File[] $files
*/
private function refactorNodesWithRectors(array $files, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($files as $file) {
$this->currentFileProvider->setFile($file);
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$this->fileProcessor->refactor($file);
}, 'refactoring', $configuration);
}
}
private function tryCatchWrapper(\Rector\Core\ValueObject\Application\File $file, callable $callback, string $phase, \Rector\Core\ValueObject\Configuration $configuration) : void
private function refactorNodesWithRectors(\Rector\Core\ValueObject\Application\File $file) : void
{
$this->currentFileProvider->setFile($file);
$this->advance($file, $phase, $configuration);
$this->tryCatchWrapper($file, function (\Rector\Core\ValueObject\Application\File $file) : void {
$this->fileProcessor->refactor($file);
}, \Rector\Core\Enum\ApplicationPhase::REFACTORING());
}
private function tryCatchWrapper(\Rector\Core\ValueObject\Application\File $file, callable $callback, \Rector\Core\Enum\ApplicationPhase $applicationPhase) : void
{
$this->currentFileProvider->setFile($file);
$this->notifyPhase($file, $applicationPhase);
try {
if (\in_array($file, $this->notParsedFiles, \true)) {
// we cannot process this file
@ -202,37 +152,14 @@ final class PhpFileProcessor implements \Rector\Core\Contract\Processor\FileProc
$file->changeFileContent($newContent);
$this->fileDiffFileDecorator->decorate([$file]);
}
/**
* This prevent CI report flood with 1 file = 1 line in progress bar
*/
private function configureStepCount(int $fileCount) : void
private function notifyPhase(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\Enum\ApplicationPhase $applicationPhase) : void
{
$this->symfonyStyle->progressStart($fileCount * self::PROGRESS_BAR_STEP_MULTIPLIER);
$progressBar = $this->privatesAccessor->getPrivateProperty($this->symfonyStyle, 'progressBar');
if (!$progressBar instanceof \RectorPrefix20210702\Symfony\Component\Console\Helper\ProgressBar) {
throw new \Rector\Core\Exception\ShouldNotHappenException();
}
if ($progressBar->getMaxSteps() < 40) {
if (!$this->symfonyStyle->isVerbose()) {
return;
}
$redrawFrequency = (int) ($progressBar->getMaxSteps() / 20);
$progressBar->setRedrawFrequency($redrawFrequency);
}
private function advance(\Rector\Core\ValueObject\Application\File $file, string $phase, \Rector\Core\ValueObject\Configuration $configuration) : void
{
if ($this->symfonyStyle->isVerbose()) {
$smartFileInfo = $file->getSmartFileInfo();
$relativeFilePath = $smartFileInfo->getRelativeFilePathFromDirectory(\getcwd());
$message = \sprintf('[%s] %s', $phase, $relativeFilePath);
$this->symfonyStyle->writeln($message);
} elseif ($configuration->shouldShowProgressBar()) {
$this->symfonyStyle->progressAdvance();
}
}
private function printFileErrors(\Rector\Core\ValueObject\Application\File $file) : void
{
foreach ($file->getErrors() as $rectorError) {
$this->symfonyStyle->error($rectorError->getMessage());
}
$smartFileInfo = $file->getSmartFileInfo();
$relativeFilePath = $smartFileInfo->getRelativeFilePathFromDirectory(\getcwd());
$message = \sprintf('[%s] %s', $applicationPhase, $relativeFilePath);
$this->symfonyStyle->writeln($message);
}
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '9b92c6ee0cbc0bac64001d348952076ebb83c411';
public const PACKAGE_VERSION = '2a0cae550788d85e58b1b603899c121e5df519b8';
/**
* @var string
*/
public const RELEASE_DATE = '2021-07-02 14:01:13';
public const RELEASE_DATE = '2021-07-02 22:45:25';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210702\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -6,6 +6,7 @@ namespace Rector\Core\Configuration;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Core\ValueObject\Configuration;
use RectorPrefix20210702\Symfony\Component\Console\Input\InputInterface;
use RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle;
use RectorPrefix20210702\Symplify\PackageBuilder\Parameter\ParameterProvider;
final class ConfigurationFactory
{
@ -13,9 +14,14 @@ final class ConfigurationFactory
* @var \Symplify\PackageBuilder\Parameter\ParameterProvider
*/
private $parameterProvider;
public function __construct(\RectorPrefix20210702\Symplify\PackageBuilder\Parameter\ParameterProvider $parameterProvider)
/**
* @var \Symfony\Component\Console\Style\SymfonyStyle
*/
private $symfonyStyle;
public function __construct(\RectorPrefix20210702\Symplify\PackageBuilder\Parameter\ParameterProvider $parameterProvider, \RectorPrefix20210702\Symfony\Component\Console\Style\SymfonyStyle $symfonyStyle)
{
$this->parameterProvider = $parameterProvider;
$this->symfonyStyle = $symfonyStyle;
}
public function createForTests() : \Rector\Core\ValueObject\Configuration
{
@ -42,6 +48,9 @@ final class ConfigurationFactory
if ($noProgressBar) {
return \false;
}
if ($this->symfonyStyle->isVerbose()) {
return \false;
}
return $outputFormat === \Rector\ChangesReporting\Output\ConsoleOutputFormatter::NAME;
}
/**

View File

@ -7,9 +7,8 @@ use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
interface FileProcessorInterface
{
// @todo wait for implementers to adapt with 2nd parameters of Configuration $configuration
// public function supports(File $file, Configuration $configuration): bool;
// public function process(array $files, Configuration $configuration): void;
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool;
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void;
/**
* @return string[]
*/

View File

@ -0,0 +1,36 @@
<?php
declare (strict_types=1);
namespace Rector\Core\Enum;
use RectorPrefix20210702\MyCLabs\Enum\Enum;
/**
* @method static ApplicationPhase REFACTORING()
* @method static ApplicationPhase PRINT_SKIP()
* @method static ApplicationPhase PRINT()
* @method static ApplicationPhase POST_RECTORS()
* @method static ApplicationPhase PARSING()
*/
final class ApplicationPhase extends \RectorPrefix20210702\MyCLabs\Enum\Enum
{
/**
* @var string
*/
private const REFACTORING = 'refactoring';
/**
* @var string
*/
private const PRINT_SKIP = 'printing skipped due error';
/**
* @var string
*/
private const PRINT = 'print';
/**
* @var string
*/
private const POST_RECTORS = 'post rectors';
/**
* @var string
*/
private const PARSING = 'parsing';
}

View File

@ -24,13 +24,11 @@ final class NonPhpFileProcessor implements \Rector\Core\Contract\Processor\FileP
{
$this->nonPhpRectors = $nonPhpRectors;
}
/**
* @param File[] $files
*/
public function process(array $files, \Rector\Core\ValueObject\Configuration $configuration) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($files as $file) {
$this->processFile($file);
foreach ($this->nonPhpRectors as $nonPhpRector) {
$newFileContent = $nonPhpRector->refactorFileContent($file->getFileContent());
$file->changeFileContent($newFileContent);
}
}
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
@ -54,11 +52,4 @@ final class NonPhpFileProcessor implements \Rector\Core\Contract\Processor\FileP
{
return \Rector\Core\ValueObject\StaticNonPhpFileSuffixes::SUFFIXES;
}
private function processFile(\Rector\Core\ValueObject\Application\File $file) : void
{
foreach ($this->nonPhpRectors as $nonPhpRector) {
$newFileContent = $nonPhpRector->refactorFileContent($file->getFileContent());
$file->changeFileContent($newFileContent);
}
}
}

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f::getLoader();
return ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882::getLoader();

View File

@ -1815,6 +1815,7 @@ return array(
'Rector\\Core\\DependencyInjection\\Loader\\ConfigurableCallValuesCollectingPhpFileLoader' => $baseDir . '/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php',
'Rector\\Core\\DependencyInjection\\RectorContainerFactory' => $baseDir . '/src/DependencyInjection/RectorContainerFactory.php',
'Rector\\Core\\Differ\\DefaultDiffer' => $baseDir . '/src/Differ/DefaultDiffer.php',
'Rector\\Core\\Enum\\ApplicationPhase' => $baseDir . '/src/Enum/ApplicationPhase.php',
'Rector\\Core\\Error\\ExceptionCorrector' => $baseDir . '/src/Error/ExceptionCorrector.php',
'Rector\\Core\\Exception\\Application\\FileProcessingException' => $baseDir . '/src/Exception/Application/FileProcessingException.php',
'Rector\\Core\\Exception\\Configuration\\InvalidConfigurationException' => $baseDir . '/src/Exception/Configuration/InvalidConfigurationException.php',
@ -3212,9 +3213,9 @@ return array(
'Ssch\\TYPO3Rector\\FileProcessor\\Composer\\Rector\\RemoveCmsPackageDirFromExtraComposerRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Composer/Rector/RemoveCmsPackageDirFromExtraComposerRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\FlexForms\\FlexFormsProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/FlexForms/FlexFormsProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\FlexForms\\Rector\\RenderTypeFlexFormRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/FlexForms/Rector/RenderTypeFlexFormRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\FluidProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Fluid/FluidProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\FluidFileProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Fluid/FluidFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\Rector\\DefaultSwitchFluidRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Fluid/Rector/DefaultSwitchFluidRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\IconsProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/IconsProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\IconsFileProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/IconsFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\Rector\\IconsRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/Rector/IconsRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Conditions\\AbstractGlobalConditionMatcher' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Conditions/AbstractGlobalConditionMatcher.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Conditions\\AbstractRootlineConditionMatcher' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Conditions/AbstractRootlineConditionMatcher.php',
@ -3240,8 +3241,8 @@ return array(
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\ExtbasePersistenceTypoScriptRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/ExtbasePersistenceTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\FileIncludeToImportStatementTypoScriptRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/FileIncludeToImportStatementTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\OldConditionToExpressionLanguageTypoScriptRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/OldConditionToExpressionLanguageTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\TypoScriptProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/TypoScriptProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\FormYamlProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/FormYamlProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\TypoScriptFileProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\FormYamlFileProcessor' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\Rector\\EmailFinisherRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/Rector/EmailFinisherRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\Rector\\TranslationFileRector' => $vendorDir . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/Rector/TranslationFileRector.php',
'Ssch\\TYPO3Rector\\Helper\\ArrayUtility' => $vendorDir . '/ssch/typo3-rector/src/Helper/ArrayUtility.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f
class ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882', '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\ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf490057658a548a4f3c4a64f6c05a882::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitf490057658a548a4f3c4a64f6c05a882::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire577045cc1c27702c2f2acb95e3525e0f($fileIdentifier, $file);
composerRequiref490057658a548a4f3c4a64f6c05a882($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire577045cc1c27702c2f2acb95e3525e0f($fileIdentifier, $file)
function composerRequiref490057658a548a4f3c4a64f6c05a882($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f
class ComposerStaticInitf490057658a548a4f3c4a64f6c05a882
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -2170,6 +2170,7 @@ class ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f
'Rector\\Core\\DependencyInjection\\Loader\\ConfigurableCallValuesCollectingPhpFileLoader' => __DIR__ . '/../..' . '/src/DependencyInjection/Loader/ConfigurableCallValuesCollectingPhpFileLoader.php',
'Rector\\Core\\DependencyInjection\\RectorContainerFactory' => __DIR__ . '/../..' . '/src/DependencyInjection/RectorContainerFactory.php',
'Rector\\Core\\Differ\\DefaultDiffer' => __DIR__ . '/../..' . '/src/Differ/DefaultDiffer.php',
'Rector\\Core\\Enum\\ApplicationPhase' => __DIR__ . '/../..' . '/src/Enum/ApplicationPhase.php',
'Rector\\Core\\Error\\ExceptionCorrector' => __DIR__ . '/../..' . '/src/Error/ExceptionCorrector.php',
'Rector\\Core\\Exception\\Application\\FileProcessingException' => __DIR__ . '/../..' . '/src/Exception/Application/FileProcessingException.php',
'Rector\\Core\\Exception\\Configuration\\InvalidConfigurationException' => __DIR__ . '/../..' . '/src/Exception/Configuration/InvalidConfigurationException.php',
@ -3567,9 +3568,9 @@ class ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f
'Ssch\\TYPO3Rector\\FileProcessor\\Composer\\Rector\\RemoveCmsPackageDirFromExtraComposerRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Composer/Rector/RemoveCmsPackageDirFromExtraComposerRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\FlexForms\\FlexFormsProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/FlexForms/FlexFormsProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\FlexForms\\Rector\\RenderTypeFlexFormRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/FlexForms/Rector/RenderTypeFlexFormRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\FluidProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Fluid/FluidProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\FluidFileProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Fluid/FluidFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Fluid\\Rector\\DefaultSwitchFluidRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Fluid/Rector/DefaultSwitchFluidRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\IconsProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/IconsProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\IconsFileProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/IconsFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Resources\\Icons\\Rector\\IconsRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Resources/Icons/Rector/IconsRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Conditions\\AbstractGlobalConditionMatcher' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Conditions/AbstractGlobalConditionMatcher.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Conditions\\AbstractRootlineConditionMatcher' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Conditions/AbstractRootlineConditionMatcher.php',
@ -3595,8 +3596,8 @@ class ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\ExtbasePersistenceTypoScriptRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/ExtbasePersistenceTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\FileIncludeToImportStatementTypoScriptRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/FileIncludeToImportStatementTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\Rector\\OldConditionToExpressionLanguageTypoScriptRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/Rector/OldConditionToExpressionLanguageTypoScriptRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\TypoScriptProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/TypoScriptProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\FormYamlProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/FormYamlProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\TypoScript\\TypoScriptFileProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\FormYamlFileProcessor' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\Rector\\EmailFinisherRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/Rector/EmailFinisherRector.php',
'Ssch\\TYPO3Rector\\FileProcessor\\Yaml\\Form\\Rector\\TranslationFileRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/FileProcessor/Yaml/Form/Rector/TranslationFileRector.php',
'Ssch\\TYPO3Rector\\Helper\\ArrayUtility' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Helper/ArrayUtility.php',
@ -3844,9 +3845,9 @@ class ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit577045cc1c27702c2f2acb95e3525e0f::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf490057658a548a4f3c4a64f6c05a882::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf490057658a548a4f3c4a64f6c05a882::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf490057658a548a4f3c4a64f6c05a882::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1351,17 +1351,17 @@
},
{
"name": "rector\/rector-nette",
"version": "0.11.11",
"version_normalized": "0.11.11.0",
"version": "0.11.14",
"version_normalized": "0.11.14.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
"reference": "7120e3e1db27d404fe4f169134980d598caaa49c"
"reference": "7fb9c218c4d89ad05e2c331f11c24e73f38c43f5"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/7120e3e1db27d404fe4f169134980d598caaa49c",
"reference": "7120e3e1db27d404fe4f169134980d598caaa49c",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/7fb9c218c4d89ad05e2c331f11c24e73f38c43f5",
"reference": "7fb9c218c4d89ad05e2c331f11c24e73f38c43f5",
"shasum": ""
},
"require": {
@ -1387,7 +1387,7 @@
"symplify\/phpstan-rules": "^9.3",
"symplify\/rule-doc-generator": "^9.3"
},
"time": "2021-06-28T18:53:07+00:00",
"time": "2021-07-02T17:44:29+00:00",
"type": "rector-extension",
"extra": {
"branch-alias": {
@ -1412,7 +1412,7 @@
"description": "Rector upgrades rules for Nette Framework",
"support": {
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.11"
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.14"
},
"install-path": "..\/rector\/rector-nette"
},
@ -1611,17 +1611,17 @@
},
{
"name": "ssch\/typo3-rector",
"version": "v0.11.19",
"version_normalized": "0.11.19.0",
"version": "dev-main",
"version_normalized": "dev-main",
"source": {
"type": "git",
"url": "https:\/\/github.com\/sabbelasichon\/typo3-rector.git",
"reference": "5eeda76afb010828142d79965044d5da63ef5a72"
"reference": "8117d4e663d624cc5dac7dcaf3bae78a5f846656"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/5eeda76afb010828142d79965044d5da63ef5a72",
"reference": "5eeda76afb010828142d79965044d5da63ef5a72",
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/8117d4e663d624cc5dac7dcaf3bae78a5f846656",
"reference": "8117d4e663d624cc5dac7dcaf3bae78a5f846656",
"shasum": ""
},
"require": {
@ -1638,7 +1638,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/rector-generator": "^0.1.7",
"rector\/rector-phpstan-rules": "^0.3.4",
"rector\/rector-src": "^0.11.22",
"rector\/rector-src": "dev-main#d807e48",
"symplify\/coding-standard": "^9.3",
"symplify\/easy-coding-standard": "^9.3",
"symplify\/phpstan-extensions": "^9.3",
@ -1646,7 +1646,8 @@
"symplify\/rule-doc-generator": "^9.3",
"tracy\/tracy": "^2.8"
},
"time": "2021-06-30T07:01:53+00:00",
"time": "2021-07-02T19:36:25+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
"rector": {
@ -1678,7 +1679,7 @@
"description": "Instant fixes for your TYPO3 code by using Rector.",
"support": {
"issues": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/issues",
"source": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/tree\/v0.11.19"
"source": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/tree\/main"
},
"funding": [
{

File diff suppressed because one or more lines are too long

View File

@ -59,7 +59,7 @@ class ObjectPath
* @param string $name
* @return self
*/
public function append($name)
public function append(string $name)
{
if ($name[0] === '.') {
return new self($this->absoluteName . $name, $name);

View File

@ -18,7 +18,7 @@ interface ContainerInterface
*
* @return mixed Entry.
*/
public function get($id);
public function get(string $id);
/**
* Returns true if the container can return an entry for the given identifier.
* Returns false otherwise.
@ -30,5 +30,5 @@ interface ContainerInterface
*
* @return bool
*/
public function has($id);
public function has(string $id);
}

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.9'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.11'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.19'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.9'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.14'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 8117d4e'));
private function __construct()
{
}

View File

@ -5,6 +5,7 @@ namespace Rector\Nette\FileProcessor;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\Nette\Contract\Rector\LatteRectorInterface;
final class LatteFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
@ -19,20 +20,15 @@ final class LatteFileProcessor implements \Rector\Core\Contract\Processor\FilePr
{
$this->latteRectors = $latteRectors;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($files as $file) {
$fileContent = $file->getFileContent();
foreach ($this->latteRectors as $latteRector) {
$fileContent = $latteRector->changeContent($fileContent);
}
$file->changeFileContent($fileContent);
$fileContent = $file->getFileContent();
foreach ($this->latteRectors as $latteRector) {
$fileContent = $latteRector->changeContent($fileContent);
}
$file->changeFileContent($fileContent);
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$fileInfo = $file->getSmartFileInfo();
return $fileInfo->hasSuffixes($this->getSupportedFileExtensions());

View File

@ -5,6 +5,7 @@ namespace Rector\Nette\FileProcessor;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\Nette\Contract\Rector\NeonRectorInterface;
final class NeonFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
@ -19,20 +20,15 @@ final class NeonFileProcessor implements \Rector\Core\Contract\Processor\FilePro
{
$this->neonRectors = $neonRectors;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($files as $file) {
$fileContent = $file->getFileContent();
foreach ($this->neonRectors as $neonRector) {
$fileContent = $neonRector->changeContent($fileContent);
}
$file->changeFileContent($fileContent);
$fileContent = $file->getFileContent();
foreach ($this->neonRectors as $neonRector) {
$fileContent = $neonRector->changeContent($fileContent);
}
$file->changeFileContent($fileContent);
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$fileInfo = $file->getSmartFileInfo();
return $fileInfo->hasSuffixes($this->getSupportedFileExtensions());

View File

@ -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('RectorPrefix20210702\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f', false) && !interface_exists('ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f', false) && !trait_exists('ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f', false)) {
spl_autoload_call('RectorPrefix20210702\ComposerAutoloaderInit577045cc1c27702c2f2acb95e3525e0f');
if (!class_exists('ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882', false) && !interface_exists('ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882', false) && !trait_exists('ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882', false)) {
spl_autoload_call('RectorPrefix20210702\ComposerAutoloaderInitf490057658a548a4f3c4a64f6c05a882');
}
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
spl_autoload_call('RectorPrefix20210702\Doctrine\Inflector\Inflector');
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210702\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire577045cc1c27702c2f2acb95e3525e0f')) {
function composerRequire577045cc1c27702c2f2acb95e3525e0f() {
return \RectorPrefix20210702\composerRequire577045cc1c27702c2f2acb95e3525e0f(...func_get_args());
if (!function_exists('composerRequiref490057658a548a4f3c4a64f6c05a882')) {
function composerRequiref490057658a548a4f3c4a64f6c05a882() {
return \RectorPrefix20210702\composerRequiref490057658a548a4f3c4a64f6c05a882(...func_get_args());
}
}
if (!function_exists('parseArgs')) {

View File

@ -20,7 +20,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/rector-generator": "^0.1.7",
"rector\/rector-phpstan-rules": "^0.3.4",
"rector\/rector-src": "^0.11.22",
"rector\/rector-src": "dev-main#d807e48",
"symplify\/coding-standard": "^9.3",
"symplify\/easy-coding-standard": "^9.3",
"symplify\/phpstan-extensions": "^9.3",

View File

@ -11,7 +11,7 @@ use RectorPrefix20210702\Helmich\TypoScriptParser\Parser\Printer\PrettyPrinter;
use RectorPrefix20210702\Helmich\TypoScriptParser\Parser\Traverser\Traverser;
use RectorPrefix20210702\Helmich\TypoScriptParser\Tokenizer\Tokenizer;
use RectorPrefix20210702\Helmich\TypoScriptParser\Tokenizer\TokenizerInterface;
use Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptProcessor;
use Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptFileProcessor;
use RectorPrefix20210702\Symfony\Component\Console\Output\BufferedOutput;
use RectorPrefix20210702\Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
@ -30,5 +30,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
$services->set(\RectorPrefix20210702\Symfony\Component\Console\Output\BufferedOutput::class);
$services->alias(\RectorPrefix20210702\Symfony\Component\Console\Output\OutputInterface::class, \RectorPrefix20210702\Symfony\Component\Console\Output\BufferedOutput::class);
$services->set(\RectorPrefix20210702\Helmich\TypoScriptParser\Parser\AST\Builder::class);
$services->set(\Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptProcessor::class)->call('configure', [[\Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptProcessor::ALLOWED_FILE_EXTENSIONS => ['typoscript', 'ts', 'txt', 'pagets', 'constantsts', 'setupts', 'tsconfig', 't3s', 't3c', 'typoscriptconstants', 'typoscriptsetupts']]]);
$services->set(\Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptFileProcessor::class)->call('configure', [[\Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptFileProcessor::ALLOWED_FILE_EXTENSIONS => ['typoscript', 'ts', 'txt', 'pagets', 'constantsts', 'setupts', 'tsconfig', 't3s', 't3c', 'typoscriptconstants', 'typoscriptsetupts']]]);
};

View File

@ -3,7 +3,7 @@
declare (strict_types=1);
namespace RectorPrefix20210702;
use Ssch\TYPO3Rector\FileProcessor\Resources\Icons\IconsProcessor;
use Ssch\TYPO3Rector\FileProcessor\Resources\Icons\IconsFileProcessor;
use Ssch\TYPO3Rector\FileProcessor\Resources\Icons\Rector\IconsRector;
use Ssch\TYPO3Rector\Rector\v8\v3\RefactorMethodFileContentRector;
use Ssch\TYPO3Rector\Rector\v8\v3\RefactorQueryViewTableWrapRector;
@ -14,5 +14,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
$services->set(\Ssch\TYPO3Rector\Rector\v8\v3\RefactorMethodFileContentRector::class);
$services->set(\Ssch\TYPO3Rector\Rector\v8\v3\RefactorQueryViewTableWrapRector::class);
$services->set(\Ssch\TYPO3Rector\FileProcessor\Resources\Icons\Rector\IconsRector::class);
$services->set(\Ssch\TYPO3Rector\FileProcessor\Resources\Icons\IconsProcessor::class)->autowire();
$services->set(\Ssch\TYPO3Rector\FileProcessor\Resources\Icons\IconsFileProcessor::class)->autowire();
};

View File

@ -60,7 +60,7 @@ This is also configurable in your rector.php configuration file:
```php
# rector.php configuration file
use Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptProcessor;
use Ssch\TYPO3Rector\FileProcessor\TypoScript\TypoScriptFileProcessor;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
@ -68,9 +68,9 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(TypoScriptProcessor::class)
$services->set(TypoScriptFileProcessor::class)
->call('configure', [[
TypoScriptProcessor::ALLOWED_FILE_EXTENSIONS => [
TypoScriptFileProcessor::ALLOWED_FILE_EXTENSIONS => [
'special',
],
]]);

View File

@ -25,7 +25,9 @@ declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\PostRector\Rector\NameImportingPostRector;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\FileProcessor\Composer\Rector\ExtensionComposerRector;
use Ssch\TYPO3Rector\Rector\General\ConvertTypo3ConfVarsRector;
use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector;
use Ssch\TYPO3Rector\Set\Typo3SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
@ -89,14 +91,20 @@ return static function (ContainerConfigurator $containerConfigurator): void {
// ]);
// get services (needed for register a single rule)
// $services = $containerConfigurator->services();
$services = $containerConfigurator->services();
// register a single rule
// $services->set(InjectAnnotationRector::class);
/**
* Useful rule from RectorPHP itself to transform i.e. GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')
* to GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class) calls.
* But be warned, sometimes it produces false positives (edge cases), so watch out
*/
// $services->set(StringClassNameToClassConstantRector::class);
// Optional non-php file functionalities:
// More info here: https://github.com/sabbelasichon/typo3-rector/blob/main/docs/beyond_php_file_processors.md
// @see https://github.com/sabbelasichon/typo3-rector/blob/main/docs/beyond_php_file_processors.md
// Adapt your composer.json dependencies to the latest available version for the defined SetList
// $containerConfigurator->import(Typo3SetList::COMPOSER_PACKAGES_104_CORE);
@ -105,8 +113,14 @@ return static function (ContainerConfigurator $containerConfigurator): void {
// Rewrite your extbase persistence class mapping from typoscript into php according to official docs.
// This processor will create a summarized file with all of the typoscript rewrites combined into a single file.
// The filename can be passed as argument, "Configuration_Extbase_Persistence_Classes.php" is default.
// $services = $containerConfigurator->services();
// $services->set(ExtbasePersistenceVisitor::class);
// $services->set(ExtbasePersistenceTypoScriptRector::class);
// Add some general TYPO3 rules
$services->set(ConvertTypo3ConfVarsRector::class);
$services->set(ExtEmConfRector::class);
$services->set(ExtensionComposerRector::class);
// Do you want to modernize your TypoScript include statements for files and move from <INCLUDE /> to @import use the FileIncludeToImportStatementVisitor
// $services->set(FileIncludeToImportStatementVisitor::class);
};
```

View File

@ -7,6 +7,7 @@ use DOMDocument;
use Exception;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Ssch\TYPO3Rector\Contract\FileProcessor\FlexForms\Rector\FlexFormRectorInterface;
use UnexpectedValueException;
/**
@ -25,41 +26,11 @@ final class FlexFormsProcessor implements \Rector\Core\Contract\Processor\FilePr
{
$this->flexFormRectors = $flexFormRectors;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
if ([] === $this->flexFormRectors) {
return;
}
foreach ($files as $file) {
$this->processFile($file);
}
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
if (!\in_array($smartFileInfo->getExtension(), $this->getSupportedFileExtensions(), \true)) {
return \false;
}
$fileContent = $file->getFileContent();
try {
$xml = @\simplexml_load_string($fileContent);
} catch (\Exception $exception) {
return \false;
}
if (\false === $xml) {
return \false;
}
return 'T3DataStructure' === $xml->getName();
}
public function getSupportedFileExtensions() : array
{
return ['xml'];
}
private function processFile(\Rector\Core\ValueObject\Application\File $file) : void
{
$domDocument = new \DOMDocument();
$domDocument->formatOutput = \true;
$domDocument->loadXML($file->getFileContent());
@ -80,4 +51,25 @@ final class FlexFormsProcessor implements \Rector\Core\Contract\Processor\FilePr
$newFileContent = \html_entity_decode($xml);
$file->changeFileContent($newFileContent);
}
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
if (!\in_array($smartFileInfo->getExtension(), $this->getSupportedFileExtensions(), \true)) {
return \false;
}
$fileContent = $file->getFileContent();
try {
$xml = @\simplexml_load_string($fileContent);
} catch (\Exception $exception) {
return \false;
}
if (\false === $xml) {
return \false;
}
return 'T3DataStructure' === $xml->getName();
}
public function getSupportedFileExtensions() : array
{
return ['xml'];
}
}

View File

@ -5,11 +5,12 @@ namespace Ssch\TYPO3Rector\FileProcessor\Fluid;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Ssch\TYPO3Rector\Contract\FileProcessor\Fluid\Rector\FluidRectorInterface;
/**
* @see \Ssch\TYPO3Rector\Tests\FileProcessor\Fluid\FluidProcessorTest
*/
final class FluidProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
final class FluidFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var mixed[]
@ -22,31 +23,22 @@ final class FluidProcessor implements \Rector\Core\Contract\Processor\FileProces
{
$this->fluidRectors = $fluidRectors;
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
return \in_array($smartFileInfo->getExtension(), $this->getSupportedFileExtensions(), \true);
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
if ([] === $this->fluidRectors) {
return;
}
foreach ($files as $file) {
$this->processFile($file);
foreach ($this->fluidRectors as $fluidRector) {
$fluidRector->transform($file);
}
}
public function getSupportedFileExtensions() : array
{
return ['html', 'xml', 'txt'];
}
private function processFile(\Rector\Core\ValueObject\Application\File $file) : void
{
foreach ($this->fluidRectors as $fluidRector) {
$fluidRector->transform($file);
}
}
}

View File

@ -6,6 +6,7 @@ namespace Ssch\TYPO3Rector\FileProcessor\Resources\Icons;
use RectorPrefix20210702\Nette\Utils\Strings;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
use Ssch\TYPO3Rector\Contract\FileProcessor\Resources\IconRectorInterface;
use Ssch\TYPO3Rector\Helper\FilesFinder;
@ -14,7 +15,7 @@ use RectorPrefix20210702\Symplify\SmartFileSystem\SmartFileSystem;
* @changelog https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.3/Feature-77349-AdditionalLocationsForExtensionIcons.html
* @see \Ssch\TYPO3Rector\Tests\FileProcessor\Resources\Icons\IconsProcessor\IconsProcessorTest
*/
final class IconsProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
final class IconsFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var \Ssch\TYPO3Rector\Helper\FilesFinder
@ -37,18 +38,13 @@ final class IconsProcessor implements \Rector\Core\Contract\Processor\FileProces
$this->smartFileSystem = $smartFileSystem;
$this->iconsRector = $iconsRector;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
foreach ($files as $file) {
foreach ($this->iconsRector as $iconRector) {
$iconRector->refactorFile($file);
}
foreach ($this->iconsRector as $iconRector) {
$iconRector->refactorFile($file);
}
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
if (!\RectorPrefix20210702\Nette\Utils\Strings::contains($smartFileInfo->getFilename(), 'ext_icon')) {

View File

@ -14,6 +14,7 @@ use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
use Rector\Core\Console\Output\RectorOutputStyle;
use Rector\Core\Provider\CurrentFileProvider;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Rector\FileFormatter\EditorConfig\EditorConfigParser;
use Rector\FileFormatter\ValueObject\Indent;
use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
@ -25,7 +26,7 @@ use RectorPrefix20210702\Symfony\Component\Console\Output\BufferedOutput;
/**
* @see \Ssch\TYPO3Rector\Tests\FileProcessor\TypoScript\TypoScriptProcessorTest
*/
final class TypoScriptProcessor implements \Ssch\TYPO3Rector\Contract\Processor\ConfigurableProcessorInterface
final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Processor\ConfigurableProcessorInterface
{
/**
* @var string
@ -81,17 +82,7 @@ final class TypoScriptProcessor implements \Ssch\TYPO3Rector\Contract\Processor\
$this->rectorOutputStyle = $rectorOutputStyle;
$this->typoScriptRectors = $typoScriptRectors;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
{
foreach ($files as $file) {
$this->processFile($file);
}
$this->convertTypoScriptToPhpFiles();
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
if ([] === $this->typoScriptRectors) {
return \false;
@ -99,6 +90,11 @@ final class TypoScriptProcessor implements \Ssch\TYPO3Rector\Contract\Processor\
$smartFileInfo = $file->getSmartFileInfo();
return \in_array($smartFileInfo->getExtension(), $this->allowedFileExtensions, \true);
}
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
$this->processFile($file);
$this->convertTypoScriptToPhpFiles();
}
/**
* @return string[]
*/

View File

@ -7,12 +7,13 @@ use RectorPrefix20210702\Nette\Utils\Strings;
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\Provider\CurrentFileProvider;
use Rector\Core\ValueObject\Application\File;
use Rector\Core\ValueObject\Configuration;
use Ssch\TYPO3Rector\Contract\FileProcessor\Yaml\Form\FormYamlRectorInterface;
use RectorPrefix20210702\Symfony\Component\Yaml\Yaml;
/**
* @see \Ssch\TYPO3Rector\Tests\FileProcessor\Yaml\Form\FormYamlProcessorTest
*/
final class FormYamlProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
final class FormYamlFileProcessor implements \Rector\Core\Contract\Processor\FileProcessorInterface
{
/**
* @var string[]
@ -34,30 +35,12 @@ final class FormYamlProcessor implements \Rector\Core\Contract\Processor\FilePro
$this->currentFileProvider = $currentFileProvider;
$this->transformer = $transformer;
}
/**
* @param File[] $files
*/
public function process(array $files) : void
public function process(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : void
{
// Prevent unnecessary processing
if ([] === $this->transformer) {
return;
}
foreach ($files as $file) {
$this->processFile($file);
}
}
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
return \RectorPrefix20210702\Nette\Utils\Strings::endsWith($smartFileInfo->getFilename(), 'yaml');
}
public function getSupportedFileExtensions() : array
{
return self::ALLOWED_FILE_EXTENSIONS;
}
private function processFile(\Rector\Core\ValueObject\Application\File $file) : void
{
$this->currentFileProvider->setFile($file);
$smartFileInfo = $file->getSmartFileInfo();
$yaml = \RectorPrefix20210702\Symfony\Component\Yaml\Yaml::parseFile($smartFileInfo->getRealPath());
@ -75,4 +58,16 @@ final class FormYamlProcessor implements \Rector\Core\Contract\Processor\FilePro
$newFileContent = \RectorPrefix20210702\Symfony\Component\Yaml\Yaml::dump($newYaml, 99);
$file->changeFileContent($newFileContent);
}
public function supports(\Rector\Core\ValueObject\Application\File $file, \Rector\Core\ValueObject\Configuration $configuration) : bool
{
$smartFileInfo = $file->getSmartFileInfo();
return \RectorPrefix20210702\Nette\Utils\Strings::endsWith($smartFileInfo->getFilename(), 'yaml');
}
/**
* @return string[]
*/
public function getSupportedFileExtensions() : array
{
return self::ALLOWED_FILE_EXTENSIONS;
}
}

View File

@ -17,10 +17,7 @@ trait TcaHelperTrait
$columns = $this->extractColumns($node);
return null !== $ctrl && null !== $columns;
}
/**
* @param \PhpParser\Node|null $node
*/
protected function extractArrayItemByKey($node, string $key) : ?\PhpParser\Node\Expr\ArrayItem
protected function extractArrayItemByKey(?\PhpParser\Node $node, string $key) : ?\PhpParser\Node\Expr\ArrayItem
{
if (null === $node) {
return null;
@ -42,10 +39,7 @@ trait TcaHelperTrait
}
return null;
}
/**
* @param \PhpParser\Node|null $node
*/
protected function extractSubArrayByKey($node, string $key) : ?\PhpParser\Node\Expr\Array_
protected function extractSubArrayByKey(?\PhpParser\Node $node, string $key) : ?\PhpParser\Node\Expr\Array_
{
if (null === $node) {
return null;
@ -60,10 +54,7 @@ trait TcaHelperTrait
}
return $columnItems;
}
/**
* @param \PhpParser\Node|null $node
*/
protected function extractArrayValueByKey($node, string $key) : ?\PhpParser\Node\Expr
protected function extractArrayValueByKey(?\PhpParser\Node $node, string $key) : ?\PhpParser\Node\Expr
{
$item = $this->extractArrayItemByKey($node, $key);
if (null === $item || null === $item->value) {

View File

@ -117,9 +117,9 @@ final class ExtbaseCommandControllerToSymfonyCommandRector extends \Rector\Core\
}
$commandPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($commandMethod);
$paramTags = $commandPhpDocInfo->getParamTagValueNodes();
$descriptionPhpDocNode = $commandPhpDocInfo->getByType(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class);
$descriptionPhpDocNodes = $commandPhpDocInfo->getByType(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class);
$methodParameters = $commandMethod->params;
$commandDescription = null !== $descriptionPhpDocNode ? (string) $descriptionPhpDocNode : '';
$commandDescription = (string) $descriptionPhpDocNodes[0] ?? '';
$commandTemplate = $this->templateFinder->getCommand();
$commandName = \RectorPrefix20210702\Nette\Utils\Strings::firstUpper($commandMethodName);
$commandContent = $commandTemplate->getContents();

View File

@ -104,7 +104,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
// Rewrite your extbase persistence class mapping from typoscript into php according to official docs.
// This processor will create a summarized file with all of the typoscript rewrites combined into a single file.
// The filename can be passed as argument, "Configuration_Extbase_Persistence_Classes.php" is default.
// $services->set(ExtbasePersistenceVisitor::class);
// $services->set(ExtbasePersistenceTypoScriptRector::class);
// Add some general TYPO3 rules
$services->set(ConvertTypo3ConfVarsRector::class);
$services->set(ExtEmConfRector::class);

View File

@ -62,7 +62,7 @@ abstract class FileLoader extends \RectorPrefix20210702\Symfony\Component\Config
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
public function import($resource, string $type = null, $ignoreErrors = \false, $sourceResource = null, $exclude = null)
public function import($resource, string $type = null, bool $ignoreErrors = \false, string $sourceResource = null, $exclude = null)
{
if (\is_string($resource) && \strlen($resource) !== ($i = \strcspn($resource, '*?{[')) && \false === \strpos($resource, "\n")) {
$excluded = [];

View File

@ -215,10 +215,8 @@ class Command
*
* @see setCode()
* @see execute()
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
public function run($input, $output)
public function run(\RectorPrefix20210702\Symfony\Component\Console\Input\InputInterface $input, \RectorPrefix20210702\Symfony\Component\Console\Output\OutputInterface $output)
{
// add the application arguments and options
$this->mergeApplicationDefinition();

View File

@ -50,11 +50,7 @@ final class LazyCommand extends \RectorPrefix20210702\Symfony\Component\Console\
{
return $this->isEnabled ?? $this->getCommand()->isEnabled();
}
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
public function run($input, $output) : int
public function run(\RectorPrefix20210702\Symfony\Component\Console\Input\InputInterface $input, \RectorPrefix20210702\Symfony\Component\Console\Output\OutputInterface $output) : int
{
return $this->getCommand()->run($input, $output);
}

View File

@ -29,10 +29,8 @@ class BufferedOutput extends \RectorPrefix20210702\Symfony\Component\Console\Out
}
/**
* {@inheritdoc}
* @param string $message
* @param bool $newline
*/
protected function doWrite($message, $newline)
protected function doWrite(string $message, bool $newline)
{
$this->buffer .= $message;
if ($newline) {

View File

@ -148,8 +148,6 @@ abstract class Output implements \RectorPrefix20210702\Symfony\Component\Console
}
/**
* Writes a message to the output.
* @param string $message
* @param bool $newline
*/
protected abstract function doWrite($message, $newline);
protected abstract function doWrite(string $message, bool $newline);
}

View File

@ -73,24 +73,20 @@ interface StyleInterface
* Asks a question.
*
* @return mixed
* @param callable|null $validator
*/
public function ask(string $question, ?string $default = null, $validator = null);
public function ask(string $question, ?string $default = null, callable $validator = null);
/**
* Asks a question with the user input hidden.
*
* @return mixed
* @param callable|null $validator
*/
public function askHidden(string $question, $validator = null);
public function askHidden(string $question, callable $validator = null);
/**
* Asks for confirmation.
*
* @return bool
* @param string $question
* @param bool $default
*/
public function confirm($question, $default = \true);
public function confirm(string $question, bool $default = \true);
/**
* Asks a choice question.
*

View File

@ -164,9 +164,8 @@ class MergeExtensionConfigurationContainerBuilder extends \RectorPrefix20210702\
}
/**
* {@inheritdoc}
* @param bool $resolveEnvPlaceholders
*/
public function compile($resolveEnvPlaceholders = \false)
public function compile(bool $resolveEnvPlaceholders = \false)
{
throw new \RectorPrefix20210702\Symfony\Component\DependencyInjection\Exception\LogicException(\sprintf('Cannot compile the container in extension "%s".', $this->extensionClass));
}

View File

@ -172,7 +172,7 @@ class Container implements \RectorPrefix20210702\Symfony\Component\DependencyInj
*
* @return bool true if the service is defined, false otherwise
*/
public function has($id)
public function has(string $id)
{
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
@ -199,7 +199,7 @@ class Container implements \RectorPrefix20210702\Symfony\Component\DependencyInj
*
* @see Reference
*/
public function get($id, $invalidBehavior = 1)
public function get(string $id, int $invalidBehavior = 1)
{
return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? [$this, 'make'])($id, $invalidBehavior));
}

View File

@ -433,7 +433,7 @@ class ContainerBuilder extends \RectorPrefix20210702\Symfony\Component\Dependenc
*
* @return bool true if the service is defined, false otherwise
*/
public function has($id)
public function has(string $id)
{
return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id);
}
@ -452,7 +452,7 @@ class ContainerBuilder extends \RectorPrefix20210702\Symfony\Component\Dependenc
*
* @see Reference
*/
public function get($id, $invalidBehavior = \RectorPrefix20210702\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
public function get(string $id, int $invalidBehavior = \RectorPrefix20210702\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
if ($this->isCompiled() && isset($this->removedIds[$id]) && \RectorPrefix20210702\Symfony\Component\DependencyInjection\ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
return parent::get($id);
@ -620,7 +620,7 @@ class ContainerBuilder extends \RectorPrefix20210702\Symfony\Component\Dependenc
* Set to "true" when you want to use the current ContainerBuilder
* directly, keep to "false" when the container is dumped instead.
*/
public function compile($resolveEnvPlaceholders = \false)
public function compile(bool $resolveEnvPlaceholders = \false)
{
$compiler = $this->getCompiler();
if ($this->trackResources) {
@ -1065,9 +1065,8 @@ class ContainerBuilder extends \RectorPrefix20210702\Symfony\Component\Dependenc
* }
*
* @return array An array of tags with the tagged service as key, holding a list of attribute arrays
* @param bool $throwOnAbstract
*/
public function findTaggedServiceIds(string $name, $throwOnAbstract = \false)
public function findTaggedServiceIds(string $name, bool $throwOnAbstract = \false)
{
$this->usedTags[] = $name;
$tags = [];

View File

@ -53,7 +53,7 @@ interface ContainerInterface extends \RectorPrefix20210702\Psr\Container\Contain
*
* @return bool true if the service is defined, false otherwise
*/
public function has($id);
public function has(string $id);
/**
* Check for whether or not a service has been initialized.
*

View File

@ -24,9 +24,8 @@ class EnvPlaceholderParameterBag extends \RectorPrefix20210702\Symfony\Component
private static $counter = 0;
/**
* {@inheritdoc}
* @param string $name
*/
public function get($name)
public function get(string $name)
{
if (0 === \strpos($name, 'env(') && ')' === \substr($name, -1) && 'env()' !== $name) {
$env = \substr($name, 4, -1);

View File

@ -56,9 +56,8 @@ class ParameterBag implements \RectorPrefix20210702\Symfony\Component\Dependency
}
/**
* {@inheritdoc}
* @param string $name
*/
public function get($name)
public function get(string $name)
{
if (!\array_key_exists($name, $this->parameters)) {
if (!$name) {
@ -101,9 +100,8 @@ class ParameterBag implements \RectorPrefix20210702\Symfony\Component\Dependency
}
/**
* {@inheritdoc}
* @param string $name
*/
public function has($name)
public function has(string $name)
{
return \array_key_exists((string) $name, $this->parameters);
}
@ -149,7 +147,7 @@ class ParameterBag implements \RectorPrefix20210702\Symfony\Component\Dependency
* @throws ParameterCircularReferenceException if a circular reference if detected
* @throws RuntimeException when a given parameter has a type problem
*/
public function resolveValue($value, $resolving = [])
public function resolveValue($value, array $resolving = [])
{
if (\is_array($value)) {
$args = [];

View File

@ -113,11 +113,10 @@ class TraceableEventDispatcher implements \RectorPrefix20210702\Symfony\Componen
}
/**
* {@inheritdoc}
* @param string|null $eventName
* @param object $event
* @return object
*/
public function dispatch($event, $eventName = null)
public function dispatch($event, string $eventName = null)
{
$eventName = $eventName ?? \get_class($event);
if (null === $this->callStack) {

View File

@ -40,11 +40,10 @@ class EventDispatcher implements \RectorPrefix20210702\Symfony\Component\EventDi
}
/**
* {@inheritdoc}
* @param string|null $eventName
* @param object $event
* @return object
*/
public function dispatch($event, $eventName = null)
public function dispatch($event, string $eventName = null)
{
$eventName = $eventName ?? \get_class($event);
if (null !== $this->optimized) {

View File

@ -38,9 +38,8 @@ final class InputBag extends \RectorPrefix20210702\Symfony\Component\HttpFoundat
}
/**
* {@inheritdoc}
* @param string|null $key
*/
public function all($key = null) : array
public function all(string $key = null) : array
{
return parent::all($key);
}

View File

@ -42,9 +42,8 @@ class FileProfilerStorage implements \RectorPrefix20210702\Symfony\Component\Htt
}
/**
* {@inheritdoc}
* @param string|null $statusCode
*/
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, $statusCode = null) : array
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, string $statusCode = null) : array
{
$file = $this->getIndexFilename();
if (!\file_exists($file)) {

View File

@ -545,7 +545,7 @@ class Process implements \IteratorAggregate
*
* @return \Generator
*/
public function getIterator($flags = 0)
public function getIterator(int $flags = 0)
{
$this->readPipesForOutput(__FUNCTION__, \false);
$clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);

View File

@ -37,9 +37,8 @@ trait ServiceLocatorTrait
* {@inheritdoc}
*
* @return bool
* @param string $id
*/
public function has($id)
public function has(string $id)
{
return isset($this->factories[$id]);
}
@ -47,9 +46,8 @@ trait ServiceLocatorTrait
* {@inheritdoc}
*
* @return mixed
* @param string $id
*/
public function get($id)
public function get(string $id)
{
if (!isset($this->factories[$id])) {
throw $this->createNotFoundException($id);

View File

@ -85,7 +85,7 @@ abstract class AbstractCloner implements \RectorPrefix20210702\Symfony\Component
*
* @return Data The cloned variable represented by a Data object
*/
public function cloneVar($var, $filter = 0)
public function cloneVar($var, int $filter = 0)
{
$this->prevErrorHandler = \set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {