Updated Rector to commit ec785119cb2a97e957bb576990efe3d09a94649b

ec785119cb [Core] Improve performance: do not compare after refactor and after post Rector stmts if  already true (#3405)
This commit is contained in:
Tomas Votruba 2023-02-23 10:40:11 +00:00
parent 34705bb179
commit 3837758530
5 changed files with 28 additions and 15 deletions

View File

@ -94,23 +94,36 @@ final class PhpFileProcessor implements FileProcessorInterface
$systemErrorsAndFileDiffs[Bridge::SYSTEM_ERRORS] = $parsingSystemErrors;
return $systemErrorsAndFileDiffs;
}
$hasChangedOnPostRector = \false;
// 2. change nodes with Rectors
do {
$file->changeHasChanged(\false);
$this->fileProcessor->refactor($file, $configuration);
$fileNewStmts = $file->getNewStmts();
// 3. apply post rectors
$newStmts = $this->postFileProcessor->traverse($file->getNewStmts());
$filePostRectorNewStmts = $this->postFileProcessor->traverse($fileNewStmts);
// this is needed for new tokens added in "afterTraverse()"
$file->changeNewStmts($newStmts);
$file->changeNewStmts($filePostRectorNewStmts);
if (!$hasChangedOnPostRector && $file->getRectorWithLineChanges() === [] && $fileNewStmts !== $filePostRectorNewStmts) {
$hasChangedOnPostRector = \true;
}
// 4. print to file or string
// important to detect if file has changed
$this->printFile($file, $configuration);
} while ($file->hasChanged());
// return json here
// return early on no diff
$fileDiff = $file->getFileDiff();
if (!$fileDiff instanceof FileDiff) {
return $systemErrorsAndFileDiffs;
}
// No Line change and no PostRector change? return early
if ($file->getRectorWithLineChanges() === [] && !$hasChangedOnPostRector) {
return $systemErrorsAndFileDiffs;
}
// return early on diff is empty
if ($fileDiff->getDiff() === '') {
return $systemErrorsAndFileDiffs;
}
$systemErrorsAndFileDiffs[Bridge::FILE_DIFFS] = [$fileDiff];
return $systemErrorsAndFileDiffs;
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'bcc44fb1de64537d2249c2960ffc1a359fb31b41';
public const PACKAGE_VERSION = 'ec785119cb2a97e957bb576990efe3d09a94649b';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-02-23 10:27:05';
public const RELEASE_DATE = '2023-02-23 10:35:42';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit5d603278d918fd9a51069cdc40b04ec3::getLoader();
return ComposerAutoloaderInit221f930b1ed2600c6e3add2adaeeadb0::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit5d603278d918fd9a51069cdc40b04ec3
class ComposerAutoloaderInit221f930b1ed2600c6e3add2adaeeadb0
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit5d603278d918fd9a51069cdc40b04ec3
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit5d603278d918fd9a51069cdc40b04ec3', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit221f930b1ed2600c6e3add2adaeeadb0', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit5d603278d918fd9a51069cdc40b04ec3', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit221f930b1ed2600c6e3add2adaeeadb0', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3
class ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3126,9 +3126,9 @@ class ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5d603278d918fd9a51069cdc40b04ec3::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit221f930b1ed2600c6e3add2adaeeadb0::$classMap;
}, null, ClassLoader::class);
}