From 6bcd7272d244af064d3a7a798b83ec7295274eb3 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 24 Sep 2023 12:10:54 +0000 Subject: [PATCH] Updated Rector to commit bd4c8dd98828626b78fd1418b1f6c985778a2fb6 https://github.com/rectorphp/rector-src/commit/bd4c8dd98828626b78fd1418b1f6c985778a2fb6 [Performance] Avoid unnecessary IO dumpFile() called when file has no change on FileProcessor (#5079) --- src/Application/FileProcessor.php | 11 ++++++++--- src/Application/VersionResolver.php | 4 ++-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++++----- vendor/composer/autoload_static.php | 8 ++++---- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index 9a22b03418dc..40b49b8e89f2 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -180,10 +180,15 @@ private function printFile(File $file, Configuration $configuration) : void return; } } - if (!$configuration->isDryRun()) { - $this->formatPerservingPrinter->dumpFile($file->getFilePath(), $newContent); - } + // change file content early to make $file->hasChanged() based on new content $file->changeFileContent($newContent); + if ($configuration->isDryRun()) { + return; + } + if (!$file->hasChanged()) { + return; + } + $this->formatPerservingPrinter->dumpFile($file->getFilePath(), $newContent); } private function parseFileNodes(File $file) : void { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 1e26c5a54f64..1fa5b86ef4ae 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '2e86f7660f53eeffb9634f1598a88a821fb6bad1'; + public const PACKAGE_VERSION = 'bd4c8dd98828626b78fd1418b1f6c985778a2fb6'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-09-24 18:06:04'; + public const RELEASE_DATE = '2023-09-24 19:06:50'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index caca901e9007..fbcc635a68bc 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit4bc8c4751d32a52c206af9507feaac50::getLoader(); +return ComposerAutoloaderInit884055323a5d40c407b56c3342c2d1fa::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 5a75d2c3a60a..f87b6190c14d 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit4bc8c4751d32a52c206af9507feaac50 +class ComposerAutoloaderInit884055323a5d40c407b56c3342c2d1fa { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit4bc8c4751d32a52c206af9507feaac50', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit884055323a5d40c407b56c3342c2d1fa', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit4bc8c4751d32a52c206af9507feaac50', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit884055323a5d40c407b56c3342c2d1fa', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit4bc8c4751d32a52c206af9507feaac50::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit884055323a5d40c407b56c3342c2d1fa::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit4bc8c4751d32a52c206af9507feaac50::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit884055323a5d40c407b56c3342c2d1fa::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b85e1fa93797..bf67e9a8e2af 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit4bc8c4751d32a52c206af9507feaac50 +class ComposerStaticInit884055323a5d40c407b56c3342c2d1fa { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2601,9 +2601,9 @@ class ComposerStaticInit4bc8c4751d32a52c206af9507feaac50 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit4bc8c4751d32a52c206af9507feaac50::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit4bc8c4751d32a52c206af9507feaac50::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit4bc8c4751d32a52c206af9507feaac50::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit884055323a5d40c407b56c3342c2d1fa::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit884055323a5d40c407b56c3342c2d1fa::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit884055323a5d40c407b56c3342c2d1fa::$classMap; }, null, ClassLoader::class); }