Updated Rector to commit 80e0123e9c36b5aa07b6ff7236caf7188df9c790

80e0123e9c [Php56] Skip AddDefaultValueForUndefinedVariableRector as coalesce left (#1238)
This commit is contained in:
Tomas Votruba 2021-11-15 05:34:37 +00:00
parent d8ebd1efd5
commit 3efee42de9
6 changed files with 27 additions and 19 deletions

View File

@ -8,6 +8,7 @@ use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\AssignRef;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\Cast\Unset_ as UnsetCast;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Isset_;
@ -112,6 +113,10 @@ final class UndefinedVariableResolver
{
return \in_array(\get_class($parentNode), [\PhpParser\Node\Stmt\Unset_::class, \PhpParser\Node\Expr\Cast\Unset_::class, \PhpParser\Node\Expr\Isset_::class], \true);
}
private function isAsCoalesceLeft(\PhpParser\Node $parentNode, \PhpParser\Node\Expr\Variable $variable) : bool
{
return $parentNode instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce && $parentNode->left === $variable;
}
private function isAssignOrStaticVariableParent(\PhpParser\Node $parentNode) : bool
{
if (\in_array(\get_class($parentNode), [\PhpParser\Node\Expr\Assign::class, \PhpParser\Node\Expr\AssignRef::class], \true)) {
@ -134,6 +139,9 @@ final class UndefinedVariableResolver
if ($this->issetOrUnsetParent($parentNode)) {
return \true;
}
if ($this->isAsCoalesceLeft($parentNode, $variable)) {
return \true;
}
// list() = | [$values] = defines variables as null
if ($this->isListAssign($parentNode)) {
return \true;

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '5154b53518632494ac07f740031ba6e8697ed4ab';
public const PACKAGE_VERSION = '80e0123e9c36b5aa07b6ff7236caf7188df9c790';
/**
* @var string
*/
public const RELEASE_DATE = '2021-11-15 08:37:04';
public const RELEASE_DATE = '2021-11-15 08:18:12';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211115\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf::getLoader();
return ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf
class ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit92b65e37d19b557117052d3e300cdcbf::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit92b65e37d19b557117052d3e300cdcbf::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire92b65e37d19b557117052d3e300cdcbf($fileIdentifier, $file);
composerRequired3558cb9b4c1ec7bc0cbf82281ab1564($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire92b65e37d19b557117052d3e300cdcbf($fileIdentifier, $file)
function composerRequired3558cb9b4c1ec7bc0cbf82281ab1564($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit92b65e37d19b557117052d3e300cdcbf
class ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3545,9 +3545,9 @@ class ComposerStaticInit92b65e37d19b557117052d3e300cdcbf
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit92b65e37d19b557117052d3e300cdcbf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit92b65e37d19b557117052d3e300cdcbf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit92b65e37d19b557117052d3e300cdcbf::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd3558cb9b4c1ec7bc0cbf82281ab1564::$classMap;
}, null, ClassLoader::class);
}

View File

@ -12,8 +12,8 @@ if (!class_exists('GenerateChangelogCommand', false) && !interface_exists('Gener
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211115\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf', false) && !interface_exists('ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf', false) && !trait_exists('ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf', false)) {
spl_autoload_call('RectorPrefix20211115\ComposerAutoloaderInit92b65e37d19b557117052d3e300cdcbf');
if (!class_exists('ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564', false) && !interface_exists('ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564', false) && !trait_exists('ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564', false)) {
spl_autoload_call('RectorPrefix20211115\ComposerAutoloaderInitd3558cb9b4c1ec7bc0cbf82281ab1564');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20211115\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3309,9 +3309,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211115\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire92b65e37d19b557117052d3e300cdcbf')) {
function composerRequire92b65e37d19b557117052d3e300cdcbf() {
return \RectorPrefix20211115\composerRequire92b65e37d19b557117052d3e300cdcbf(...func_get_args());
if (!function_exists('composerRequired3558cb9b4c1ec7bc0cbf82281ab1564')) {
function composerRequired3558cb9b4c1ec7bc0cbf82281ab1564() {
return \RectorPrefix20211115\composerRequired3558cb9b4c1ec7bc0cbf82281ab1564(...func_get_args());
}
}
if (!function_exists('parseArgs')) {