Updated Rector to commit 269858a92c

269858a92c [Php56] Skip with coalesce assign on AddDefaultValueForUndefinedVariableRector (#2078)
This commit is contained in:
Tomas Votruba 2022-04-15 11:39:05 +00:00
parent 74a8a29f4c
commit 5efb6c74b3
12 changed files with 63 additions and 56 deletions

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\AssignOp\Coalesce as AssignOpCoalesce;
use PhpParser\Node\Expr\AssignRef;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\Cast\Unset_ as UnsetCast;
@ -110,9 +111,15 @@ 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, \PhpParser\Node\Expr\Empty_::class], \true);
}
private function isAsCoalesceLeft(\PhpParser\Node $parentNode, \PhpParser\Node\Expr\Variable $variable) : bool
private function isAsCoalesceLeftOrAssignOpCoalesceVar(\PhpParser\Node $parentNode, \PhpParser\Node\Expr\Variable $variable) : bool
{
return $parentNode instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce && $parentNode->left === $variable;
if ($parentNode instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce && $parentNode->left === $variable) {
return \true;
}
if (!$parentNode instanceof \PhpParser\Node\Expr\AssignOp\Coalesce) {
return \false;
}
return $parentNode->var === $variable;
}
private function isAssign(\PhpParser\Node $parentNode) : bool
{
@ -129,7 +136,7 @@ final class UndefinedVariableResolver
if ($this->issetOrUnsetOrEmptyParent($parentNode)) {
return \true;
}
if ($this->isAsCoalesceLeft($parentNode, $variable)) {
if ($this->isAsCoalesceLeftOrAssignOpCoalesceVar($parentNode, $variable)) {
return \true;
}
// list() = | [$values] = defines variables as null

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '8be11db297fa6a1eb46ee57f64c92c547f189ba7';
public const PACKAGE_VERSION = '269858a92cbfd9aa6db06ba5f3ac1152c47bf004';
/**
* @var string
*/
public const RELEASE_DATE = '2022-04-15 09:21:53';
public const RELEASE_DATE = '2022-04-15 18:31:00';
/**
* @var string
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c
class ComposerAutoloaderInit16b3e2261246992d53bf11847629914a
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit16b3e2261246992d53bf11847629914a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit16b3e2261246992d53bf11847629914a', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInita113cab865c591a9c1e19f010f41e29c::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit16b3e2261246992d53bf11847629914a::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInita113cab865c591a9c1e19f010f41e29c::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit16b3e2261246992d53bf11847629914a::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirea113cab865c591a9c1e19f010f41e29c($fileIdentifier, $file);
composerRequire16b3e2261246992d53bf11847629914a($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c
* @param string $file
* @return void
*/
function composerRequirea113cab865c591a9c1e19f010f41e29c($fileIdentifier, $file)
function composerRequire16b3e2261246992d53bf11847629914a($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 ComposerStaticInita113cab865c591a9c1e19f010f41e29c
class ComposerStaticInit16b3e2261246992d53bf11847629914a
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3865,9 +3865,9 @@ class ComposerStaticInita113cab865c591a9c1e19f010f41e29c
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita113cab865c591a9c1e19f010f41e29c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita113cab865c591a9c1e19f010f41e29c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita113cab865c591a9c1e19f010f41e29c::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit16b3e2261246992d53bf11847629914a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit16b3e2261246992d53bf11847629914a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit16b3e2261246992d53bf11847629914a::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1083,17 +1083,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.5.5",
"version_normalized": "1.5.5.0",
"version": "1.5.6",
"version_normalized": "1.5.6.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "d77a607667f29ae099c0686f99664bd451fd23df"
"reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/d77a607667f29ae099c0686f99664bd451fd23df",
"reference": "d77a607667f29ae099c0686f99664bd451fd23df",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/799dd8c2d2c9c704bb55d2078078cb970cf0f6d1",
"reference": "799dd8c2d2c9c704bb55d2078078cb970cf0f6d1",
"shasum": ""
},
"require": {
@ -1102,7 +1102,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2022-04-14T12:20:26+00:00",
"time": "2022-04-15T11:13:37+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@ -1121,7 +1121,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.5.5"
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.5.6"
},
"funding": [
{
@ -2627,12 +2627,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "bc1630b068c4cd0030b26728e50afcb5eb6edc5b"
"reference": "0d23ce9c7097c5f9d1090219fed1629b749a2d0e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/bc1630b068c4cd0030b26728e50afcb5eb6edc5b",
"reference": "bc1630b068c4cd0030b26728e50afcb5eb6edc5b",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/0d23ce9c7097c5f9d1090219fed1629b749a2d0e",
"reference": "0d23ce9c7097c5f9d1090219fed1629b749a2d0e",
"shasum": ""
},
"require": {
@ -2660,7 +2660,7 @@
"symplify\/rule-doc-generator": "^10.0",
"symplify\/vendor-patches": "^10.0"
},
"time": "2022-04-12T16:21:34+00:00",
"time": "2022-04-15T09:56:49+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmJYEYEACgkQzxoQjQ56
5yDFAA/7ByKUiqgdPhW3d7pSVa3OuypNmaeA/5wxD2phncDiR42lb6dhdkX+Ebqs
Yz8CfqTj3rRJmDWqF4M/57/fmbXGyrRZUq++Fi/Z/zR8r8N7vxZnsKgCByDK1VYV
Co0toMI1DI6KGQoZB3dCRFHHWEntcxmCstkAN+YTWc6sqI2nO5w8jvgLjYz2kMNw
76cOl9rX8cQt9d1IDKk15zwt6Fp73hggxe7msfj9pMtuUsbYtww726123Uekyr6J
7XzpY4+D8tLpRbox0ZIuBqHAUAu7GxOHsp1pABIpN9L0+Ex+yx1zADSHsRkefJ9B
DodqqJ/qBabGHX6Q2AuV8P5d9+qqLUW6S7rVV4lVuOZcvrny72FWQTsYJn+M9LuK
A8jddErrfxbI8rQ2MGDObRKScCrIkz5IeDx+pESL2ctN9Wm045ak9OEiFntJiTpZ
KwDEe96L1nM9hdORlFTXZO6blhhYA5iwNGaB49Gs4VNTBWuGA9a3n5SH3uYGnU8O
P5SNzYixi0x3XA0bYq3e5ClfobNXY7c/wgcgJt89G8VbxtDAhDgDr1mnNoVeV/KC
8rgikQTjBt+dGLjJ3ixSbwIsDBHvTZr6a0uQjgHl6Qle+llezlF4KIhyqz8eyp6b
6rq0NvURxNNxVCN1hiOSJ7HMCUBr+dmlTcaS+iHuQpKQdl4AJ0E=
=gqPg
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmJZU1kACgkQzxoQjQ56
5yCYiw//W/UYp9b0RAvVMFYe8zcRFkyoq5+QNH6fzVu72QY3t9fwhwsw6TbaMQzZ
zGpafXZEY5HtfeeJspZSuD0Aa40+7wPwILOcHJ/FTSCsWUJ6218Ap4r3AVCNeKyR
7bwyt8ZRm3E0MJ20pIZ76N2Pc2WbBcvOqC+V1tk8mxOtIMCOL/kQBvN/CQ5dmCWC
OJQIas+sLJTdtulqd3D2CKCXcrPMPOYNpo8zvf+mHz3OSoP4P1K9Rw7d1yKHDSDU
9QeWfBxjRTZg7zZOx9P9ipB6xrGQflloJMp4uKAc40+zKv+fsnQGruV8yKQ72d87
0lsYOJqsdkmTh1/ThUK5zHnUYYHgDLtF1QiPyO4N2zSxHcZ9d3aZLuIaIm8S95Y2
eNaRCavBXhExZMc/N9dKOyqm6sA2lIAbk8tu6VztvfOszCD/BcNuB9U8c6ErMPfi
dMSR6Hn7N1aXBQm5Mo3zVn7apC8ZO7tv3y+IphvczmneKxUXkQQnilxhIbv5SMmR
gm3jTIRFRJ1PtJQAXMAeMApayLHkiR1Ba8pkoMDKD1+YOT/WMmz/foSV+ctdIpQN
h1i3B0z7S6lG2nlZAG8302riQowWYHMcx6Z3+VI8K/+PrEa8i5vQrJ395OrtWdGJ
HQo+yQDPFwnbnnQFjxkUWU/0M1Mvp5QlM0grYCHwoW3v5lczMVg=
=1qml
-----END PGP SIGNATURE-----

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 93bd8bd'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ae06e92'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 68d30fe'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 48a1f34'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e01d41e'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4b98374'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4177545'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bc1630b'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5fc785d'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 93bd8bd'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ae06e92'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 68d30fe'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 48a1f34'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e01d41e'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4b98374'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4177545'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 0d23ce9'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5fc785d'));
private function __construct()
{
}

View File

@ -19,20 +19,20 @@ To add a set to your config, use `Rector\Symfony\Set\SymfonySetList` class and p
```php
use Rector\Core\Configuration\Option;
use Rector\Symfony\Set\SymfonySetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Config\RectorConfig;
return static function (ContainerConfigurator $containerConfigurator): void {
// region Symfony Container
$parameters = $containerConfigurator->parameters();
return static function (RectorConfig $rectorConfig): void {
$parameters = $rectorConfig->parameters();
$parameters->set(
Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER,
__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'
);
// endregion
$containerConfigurator->import(SymfonySetList::SYMFONY_52);
$containerConfigurator->import(SymfonySetList::SYMFONY_CODE_QUALITY);
$containerConfigurator->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
$rectorConfig->sets([
SymfonySetList::SYMFONY_52,
SymfonySetList::SYMFONY_CODE_QUALITY
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION
]);
};
```

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220415\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c', false) && !interface_exists('ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c', false) && !trait_exists('ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c', false)) {
spl_autoload_call('RectorPrefix20220415\ComposerAutoloaderInita113cab865c591a9c1e19f010f41e29c');
if (!class_exists('ComposerAutoloaderInit16b3e2261246992d53bf11847629914a', false) && !interface_exists('ComposerAutoloaderInit16b3e2261246992d53bf11847629914a', false) && !trait_exists('ComposerAutoloaderInit16b3e2261246992d53bf11847629914a', false)) {
spl_autoload_call('RectorPrefix20220415\ComposerAutoloaderInit16b3e2261246992d53bf11847629914a');
}
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('RectorPrefix20220415\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220415\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirea113cab865c591a9c1e19f010f41e29c')) {
function composerRequirea113cab865c591a9c1e19f010f41e29c() {
return \RectorPrefix20220415\composerRequirea113cab865c591a9c1e19f010f41e29c(...func_get_args());
if (!function_exists('composerRequire16b3e2261246992d53bf11847629914a')) {
function composerRequire16b3e2261246992d53bf11847629914a() {
return \RectorPrefix20220415\composerRequire16b3e2261246992d53bf11847629914a(...func_get_args());
}
}
if (!function_exists('scanPath')) {