Updated Rector to commit 9c7da411e7a32b7adca8af2bc9640c3cf0029583

9c7da411e7 Revert file not changed detected to be printed by PhpParser (#3409)
This commit is contained in:
Tomas Votruba 2023-02-23 15:02:52 +00:00
parent 547b750176
commit 1b65d11365
9 changed files with 36 additions and 59 deletions

View File

@ -3,7 +3,6 @@
declare (strict_types=1);
namespace Rector\Core\Application\FileProcessor;
use RectorPrefix202302\Nette\Utils\FileSystem;
use PHPStan\AnalysedCodeException;
use Rector\ChangesReporting\ValueObjectFactory\ErrorFactory;
use Rector\Core\Application\FileDecorator\FileDiffFileDecorator;
@ -95,33 +94,23 @@ 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
$filePostRectorNewStmts = $this->postFileProcessor->traverse($fileNewStmts);
$newStmts = $this->postFileProcessor->traverse($file->getNewStmts());
// this is needed for new tokens added in "afterTraverse()"
$file->changeNewStmts($filePostRectorNewStmts);
if (!$hasChangedOnPostRector && $file->getRectorWithLineChanges() === [] && $fileNewStmts !== $filePostRectorNewStmts) {
$hasChangedOnPostRector = \true;
}
$file->changeNewStmts($newStmts);
// 4. print to file or string
// important to detect if file has changed
$this->printFile($file, $configuration);
} while ($file->hasChanged());
// return early on no diff
// return json here
$fileDiff = $file->getFileDiff();
if (!$fileDiff instanceof FileDiff) {
return $systemErrorsAndFileDiffs;
}
// No Line change and no PostRector change? return early
if ($file->getRectorWithLineChanges() === [] && !$hasChangedOnPostRector) {
$this->rollbackOriginalFile($file, $configuration);
return $systemErrorsAndFileDiffs;
}
$systemErrorsAndFileDiffs[Bridge::FILE_DIFFS] = [$fileDiff];
return $systemErrorsAndFileDiffs;
}
@ -137,18 +126,6 @@ final class PhpFileProcessor implements FileProcessorInterface
{
return ['php'];
}
private function rollbackOriginalFile(File $file, Configuration $configuration) : void
{
if ($configuration->isDryRun()) {
return;
}
$filePath = $file->getFilePath();
if ($this->removedAndAddedFilesCollector->isFileRemoved($filePath)) {
// skip, because this file exists no more
return;
}
Filesystem::write($filePath, $file->getOriginalFileContent());
}
/**
* @return SystemError[]
*/

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '61348a86a5a9f113e0bd7d40324b3a0eec6fcd7d';
public const PACKAGE_VERSION = '9c7da411e7a32b7adca8af2bc9640c3cf0029583';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-02-23 13:10:06';
public const RELEASE_DATE = '2023-02-23 14:58:26';
/**
* @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 ComposerAutoloaderInit651afb77cf9520c233fbcfcf57ecea47::getLoader();
return ComposerAutoloaderInit466f8ae2befaae596f962111b327b685::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit651afb77cf9520c233fbcfcf57ecea47
class ComposerAutoloaderInit466f8ae2befaae596f962111b327b685
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit651afb77cf9520c233fbcfcf57ecea47
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit651afb77cf9520c233fbcfcf57ecea47', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit466f8ae2befaae596f962111b327b685', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit651afb77cf9520c233fbcfcf57ecea47', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit466f8ae2befaae596f962111b327b685', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit466f8ae2befaae596f962111b327b685::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit466f8ae2befaae596f962111b327b685::$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 ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47
class ComposerStaticInit466f8ae2befaae596f962111b327b685
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3126,9 +3126,9 @@ class ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit651afb77cf9520c233fbcfcf57ecea47::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit466f8ae2befaae596f962111b327b685::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit466f8ae2befaae596f962111b327b685::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit466f8ae2befaae596f962111b327b685::$classMap;
}, null, ClassLoader::class);
}

View File

@ -869,17 +869,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.10.1",
"version_normalized": "1.10.1.0",
"version": "1.10.2",
"version_normalized": "1.10.2.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "1cd5fc530a8b68702f3733ad64294b2a39564198"
"reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/1cd5fc530a8b68702f3733ad64294b2a39564198",
"reference": "1cd5fc530a8b68702f3733ad64294b2a39564198",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/a2ffec7db373d8da4973d1d62add872db5cd22dd",
"reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd",
"shasum": ""
},
"require": {
@ -888,7 +888,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-02-21T21:57:23+00:00",
"time": "2023-02-23T14:36:46+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@ -911,7 +911,7 @@
],
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.10.1"
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.10.2"
},
"funding": [
{

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmP1Pi0ACgkQzxoQjQ56
5yAMnQ//dev7mbaDxJvgYiyhx01qKA70stqS0iw7jUrtaNCbFbDN9JQfHYhlkYom
TdTLZ7EtlR9cs0KFFTHdRuw5nBDQE2QJdhFuyBDDAFR/oQl108Jds85/54Mk8/jo
lkYKNKJ3ui6U5mV+hCXZZNoJJyAnkLuPvImNjTjpSQchIryvsOBGX2+5yOiSPObX
6hPFa+oNiNX6lWu+DdS1MRPvjmteLkg8mnxgZOzGBxjn/QuCes5sfQ2F2L9f6J9Y
5G66aDeWXIClhOPVFPauPRGgaZy7kgNIF+4wTMl6R6lXwLKleMlPV+NaX42k8r0r
vM+zY+AAhyjayJLvy50U3/zaSe/GkX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