Updated Rector to commit 22b612ef79a1437b891d94154285ad4a2a3e0576

22b612ef79 [Naming] Handle crash on VariableNaming::resolveBareFromNode() on unwrapNode() return null (#3136)
This commit is contained in:
Tomas Votruba 2022-12-01 14:39:21 +00:00
parent ff75474d25
commit fc7f082962
5 changed files with 27 additions and 28 deletions

View File

@ -19,7 +19,6 @@ use PHPStan\Analyser\MutatingScope;
use PHPStan\Analyser\Scope;
use PHPStan\Type\ThisType;
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\Naming\Contract\AssignVariableNameResolverInterface;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\NodeTypeResolver;
@ -111,27 +110,27 @@ final class VariableNaming
}
private function resolveBareFromNode(Node $node) : ?string
{
$node = $this->unwrapNode($node);
$unwrappedNode = $this->unwrapNode($node);
if (!$unwrappedNode instanceof Node) {
return null;
}
foreach ($this->assignVariableNameResolvers as $assignVariableNameResolver) {
if ($assignVariableNameResolver->match($node)) {
return $assignVariableNameResolver->resolve($node);
if ($assignVariableNameResolver->match($unwrappedNode)) {
return $assignVariableNameResolver->resolve($unwrappedNode);
}
}
if ($node !== null && ($node instanceof MethodCall || $node instanceof NullsafeMethodCall || $node instanceof StaticCall)) {
return $this->resolveFromMethodCall($node);
if ($unwrappedNode instanceof MethodCall || $unwrappedNode instanceof NullsafeMethodCall || $unwrappedNode instanceof StaticCall) {
return $this->resolveFromMethodCall($unwrappedNode);
}
if ($node instanceof FuncCall) {
return $this->resolveFromNode($node->name);
if ($unwrappedNode instanceof FuncCall) {
return $this->resolveFromNode($unwrappedNode->name);
}
if (!$node instanceof Node) {
throw new NotImplementedYetException();
}
$paramName = $this->nodeNameResolver->getName($node);
$paramName = $this->nodeNameResolver->getName($unwrappedNode);
if ($paramName !== null) {
return $paramName;
}
if ($node instanceof String_) {
return $node->value;
if ($unwrappedNode instanceof String_) {
return $unwrappedNode->value;
}
return null;
}

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '39f43c01cbc34a8bb064f056d39f1b8d2bd7a152';
public const PACKAGE_VERSION = '22b612ef79a1437b891d94154285ad4a2a3e0576';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-01 15:05:37';
public const RELEASE_DATE = '2022-12-01 15:33:10';
/**
* @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 ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3::getLoader();
return ComposerAutoloaderInita806b829d393c0a5e11675def42b2d90::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3
class ComposerAutoloaderInita806b829d393c0a5e11675def42b2d90
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita806b829d393c0a5e11675def42b2d90', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita806b829d393c0a5e11675def42b2d90', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInita806b829d393c0a5e11675def42b2d90::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInita806b829d393c0a5e11675def42b2d90::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirecc426ac9716fb457e803f48cd7897ae3($fileIdentifier, $file);
composerRequirea806b829d393c0a5e11675def42b2d90($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitcc426ac9716fb457e803f48cd7897ae3
* @param string $file
* @return void
*/
function composerRequirecc426ac9716fb457e803f48cd7897ae3($fileIdentifier, $file)
function composerRequirea806b829d393c0a5e11675def42b2d90($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 ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3
class ComposerStaticInita806b829d393c0a5e11675def42b2d90
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3016,9 +3016,9 @@ class ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcc426ac9716fb457e803f48cd7897ae3::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$classMap;
}, null, ClassLoader::class);
}