mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-29 07:20:52 +00:00
Updated Rector to commit 5e8ee3129dcb3e0e402aed139396f3ef887ad6ad
5e8ee3129d
Fix: print non PHP file processors changes in parallel runs (#3384)
This commit is contained in:
parent
5d735c2311
commit
9524f2ffb4
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'b2d6fa6ee64096cb358f8e29c490386989b4cfb0';
|
||||
public const PACKAGE_VERSION = '5e8ee3129dcb3e0e402aed139396f3ef887ad6ad';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-02-22 01:49:42';
|
||||
public const RELEASE_DATE = '2023-02-22 11:02:35';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
|||
namespace Rector\Core\NonPhpFile;
|
||||
|
||||
use Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
|
||||
use Rector\Core\Contract\Processor\FileProcessorInterface;
|
||||
use Rector\Core\Contract\Rector\NonPhpRectorInterface;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
|
@ -12,6 +13,7 @@ use Rector\Core\ValueObject\Error\SystemError;
|
|||
use Rector\Core\ValueObject\Reporting\FileDiff;
|
||||
use Rector\Core\ValueObject\StaticNonPhpFileSuffixes;
|
||||
use Rector\Parallel\ValueObject\Bridge;
|
||||
use RectorPrefix202302\Symfony\Component\Filesystem\Filesystem;
|
||||
final class NonPhpFileProcessor implements FileProcessorInterface
|
||||
{
|
||||
/**
|
||||
|
@ -24,13 +26,25 @@ final class NonPhpFileProcessor implements FileProcessorInterface
|
|||
* @var \Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory
|
||||
*/
|
||||
private $fileDiffFactory;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Symfony\Component\Filesystem\Filesystem
|
||||
*/
|
||||
private $filesystem;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector
|
||||
*/
|
||||
private $removedAndAddedFilesCollector;
|
||||
/**
|
||||
* @param NonPhpRectorInterface[] $nonPhpRectors
|
||||
*/
|
||||
public function __construct(array $nonPhpRectors, FileDiffFactory $fileDiffFactory)
|
||||
public function __construct(array $nonPhpRectors, FileDiffFactory $fileDiffFactory, Filesystem $filesystem, RemovedAndAddedFilesCollector $removedAndAddedFilesCollector)
|
||||
{
|
||||
$this->nonPhpRectors = $nonPhpRectors;
|
||||
$this->fileDiffFactory = $fileDiffFactory;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector;
|
||||
}
|
||||
/**
|
||||
* @return array{system_errors: SystemError[], file_diffs: FileDiff[]}
|
||||
|
@ -53,6 +67,7 @@ final class NonPhpFileProcessor implements FileProcessorInterface
|
|||
if ($oldFileContent !== $newFileContent) {
|
||||
$fileDiff = $this->fileDiffFactory->createFileDiff($file, $oldFileContent, $newFileContent);
|
||||
$systemErrorsAndFileDiffs[Bridge::FILE_DIFFS][] = $fileDiff;
|
||||
$this->printFile($file, $configuration);
|
||||
}
|
||||
return $systemErrorsAndFileDiffs;
|
||||
}
|
||||
|
@ -76,4 +91,16 @@ final class NonPhpFileProcessor implements FileProcessorInterface
|
|||
{
|
||||
return StaticNonPhpFileSuffixes::SUFFIXES;
|
||||
}
|
||||
private function printFile(File $file, Configuration $configuration) : void
|
||||
{
|
||||
$filePath = $file->getFilePath();
|
||||
if ($this->removedAndAddedFilesCollector->isFileRemoved($filePath)) {
|
||||
// skip, because this file exists no more
|
||||
return;
|
||||
}
|
||||
if ($configuration->isDryRun()) {
|
||||
return;
|
||||
}
|
||||
$this->filesystem->dumpFile($filePath, $file->getFileContent());
|
||||
}
|
||||
}
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8::getLoader();
|
||||
return ComposerAutoloaderInit1ad69bf39472f26b98236af7dca4c096::getLoader();
|
||||
|
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8
|
||||
class ComposerAutoloaderInit1ad69bf39472f26b98236af7dca4c096
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1ad69bf39472f26b98236af7dca4c096', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1ad69bf39472f26b98236af7dca4c096', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1ad69bf39472f26b98236af7dca4c096::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit1ad69bf39472f26b98236af7dca4c096::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8
|
||||
class ComposerStaticInit1ad69bf39472f26b98236af7dca4c096
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3126,9 +3126,9 @@ class ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1ad69bf39472f26b98236af7dca4c096::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1ad69bf39472f26b98236af7dca4c096::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1ad69bf39472f26b98236af7dca4c096::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user