Updated Rector to commit ffa43a11e01a594d3aaafe4eb5f09f4394e90019

ffa43a11e0 [PhpParser] Fix crash read jetbrains/phpstorm-stubs included in phpstan.phar on PHP 8.0 and PHP 7.4 (#5001)
This commit is contained in:
Tomas Votruba 2023-09-12 07:47:25 +00:00
parent 3c6c1c03f8
commit ac9f7b5076
5 changed files with 27 additions and 15 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'a2f70054a7d976acd2c73b06789095b998829be6';
public const PACKAGE_VERSION = 'ffa43a11e01a594d3aaafe4eb5f09f4394e90019';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-09-12 04:28:02';
public const RELEASE_DATE = '2023-09-12 09:43:41';
/**
* @var int
*/

View File

@ -33,6 +33,7 @@ use Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
use Rector\PhpDocParser\PhpParser\SmartPhpParser;
use Throwable;
/**
* The nodes provided by this resolver is for read-only analysis only!
* They are not part of node tree processed by Rector, so any changes will not make effect in final printed file.
@ -296,9 +297,20 @@ final class AstResolver
if (isset($this->parsedFileNodes[$fileName])) {
return $this->parsedFileNodes[$fileName];
}
$stmts = $this->smartPhpParser->parseFile($fileName);
if ($stmts === []) {
return $this->parsedFileNodes[$fileName] = [];
try {
$stmts = $this->smartPhpParser->parseFile($fileName);
} catch (Throwable $throwable) {
/**
* phpstan.phar contains jetbrains/phpstorm-stubs which the code is not downgraded
* that if read from lower php < 8.1 may cause crash
*
* @see https://github.com/rectorphp/rector/issues/8193 on php 8.0
* @see https://github.com/rectorphp/rector/issues/8145 on php 7.4
*/
if (\strpos($fileName, 'phpstan.phar') !== \false) {
return [];
}
throw $throwable;
}
return $this->parsedFileNodes[$fileName] = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($fileName, $stmts);
}

2
vendor/autoload.php vendored
View File

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

View File

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