mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 48e97cb0e710d6b7d704d31a6e3c4320486e1ed4
48e97cb0e7
[Core][e2e] Do not reprint from PhpParser when no RectorWithLineChange or empty diff (#3403)
This commit is contained in:
parent
bfb3b0cf14
commit
baee5d9d4a
@ -33,13 +33,11 @@ final class FullyQualifiedNameClassNameImportSkipVoter implements ClassNameImpor
|
||||
// "new X" or "X::static()"
|
||||
/** @var array<string, string> $shortNamesToFullyQualifiedNames */
|
||||
$shortNamesToFullyQualifiedNames = $this->shortNameResolver->resolveFromFile($file);
|
||||
$loweredShortNameFullyQualified = $fullyQualifiedObjectType->getShortNameLowered();
|
||||
foreach ($shortNamesToFullyQualifiedNames as $shortName => $fullyQualifiedName) {
|
||||
$shortNameLowered = \strtolower($shortName);
|
||||
if ($loweredShortNameFullyQualified !== $shortNameLowered) {
|
||||
if ($fullyQualifiedObjectType->getShortName() !== $shortName) {
|
||||
continue;
|
||||
}
|
||||
return $fullyQualifiedObjectType->getClassNameLowered() !== \strtolower($fullyQualifiedName);
|
||||
return $fullyQualifiedObjectType->getClassName() !== $fullyQualifiedName;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
|
@ -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 ($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;
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '4a583b6a777b38f14791374a8793f37ae024e6f9';
|
||||
public const PACKAGE_VERSION = '48e97cb0e710d6b7d704d31a6e3c4320486e1ed4';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-02-23 09:36:23';
|
||||
public const RELEASE_DATE = '2023-02-23 17:27:19';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
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 ComposerAutoloaderInita0036db571e6f3784692d7da179c45bf::getLoader();
|
||||
return ComposerAutoloaderInitaad712e8abc73da9ea9e94ef09ebace2::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 ComposerAutoloaderInita0036db571e6f3784692d7da179c45bf
|
||||
class ComposerAutoloaderInitaad712e8abc73da9ea9e94ef09ebace2
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInita0036db571e6f3784692d7da179c45bf
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInita0036db571e6f3784692d7da179c45bf', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitaad712e8abc73da9ea9e94ef09ebace2', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInita0036db571e6f3784692d7da179c45bf', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitaad712e8abc73da9ea9e94ef09ebace2', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInita0036db571e6f3784692d7da179c45bf::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInita0036db571e6f3784692d7da179c45bf::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2::$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 ComposerStaticInita0036db571e6f3784692d7da179c45bf
|
||||
class ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3126,9 +3126,9 @@ class ComposerStaticInita0036db571e6f3784692d7da179c45bf
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita0036db571e6f3784692d7da179c45bf::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita0036db571e6f3784692d7da179c45bf::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInita0036db571e6f3784692d7da179c45bf::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitaad712e8abc73da9ea9e94ef09ebace2::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user