From 6d40eadfb2309a871d672de8d560e28bc80a0b2f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 10 Jun 2021 13:15:41 +0000 Subject: [PATCH] Updated Rector to commit 6e9783c671158782b2477af6b504475b133705f6 https://github.com/rectorphp/rector-src/commit/6e9783c671158782b2477af6b504475b133705f6 [Downgrade Php 8] Handle Property Fetch and static Property fetch (#195) --- ...DowngradeClassOnObjectToGetClassRector.php | 19 +++++++++++++++---- src/Application/VersionResolver.php | 4 ++-- src/functions/node_helper.php | 11 +++-------- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +++++++------- vendor/composer/autoload_static.php | 8 ++++---- vendor/scoper-autoload.php | 10 +++++----- .../Attribute/Autoconfigure.php | 9 +-------- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php b/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php index 3e343fa8153..dc0521a0d14 100644 --- a/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php +++ b/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php @@ -7,9 +7,10 @@ use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\FuncCall; +use PhpParser\Node\Expr\PropertyFetch; +use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; -use PhpParser\Node\Param; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -18,6 +19,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; */ final class DowngradeClassOnObjectToGetClassRector extends \Rector\Core\Rector\AbstractRector { + /** + * @var string + */ + private const GET_CLASS = 'get_class'; public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition { return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Change $object::class to get_class($object)', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE' @@ -55,9 +60,15 @@ CODE_SAMPLE if (!$this->isName($node->name, 'class')) { return null; } - if (!$node->class instanceof \PhpParser\Node\Expr\Variable) { - return null; + if ($node->class instanceof \PhpParser\Node\Expr\Variable) { + return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name(self::GET_CLASS), [new \PhpParser\Node\Arg($node->class)]); } - return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name('get_class'), [new \PhpParser\Node\Arg($node->class)]); + if ($node->class instanceof \PhpParser\Node\Expr\PropertyFetch) { + return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name(self::GET_CLASS), [new \PhpParser\Node\Arg($node->class)]); + } + if ($node->class instanceof \PhpParser\Node\Expr\StaticPropertyFetch) { + return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name(self::GET_CLASS), [new \PhpParser\Node\Arg($node->class)]); + } + return null; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 72236280817..dbd049cad02 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -16,11 +16,11 @@ final class VersionResolver /** * @var string */ - public const PACKAGE_VERSION = '1a3afef04d83ebac3cef3b00b18de7773ec4332c'; + public const PACKAGE_VERSION = '6e9783c671158782b2477af6b504475b133705f6'; /** * @var string */ - public const RELEASE_DATE = '2021-06-10 10:33:49'; + public const RELEASE_DATE = '2021-06-10 13:03:40'; public static function resolvePackageVersion() : string { $process = new \RectorPrefix20210610\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__); diff --git a/src/functions/node_helper.php b/src/functions/node_helper.php index a358760cb3f..04e45d3b162 100644 --- a/src/functions/node_helper.php +++ b/src/functions/node_helper.php @@ -7,10 +7,7 @@ use PhpParser\Node; use PhpParser\PrettyPrinter\Standard; use RectorPrefix20210610\Tracy\Dumper; if (!\function_exists('dn')) { - /** - * @return void - */ - function dn(\PhpParser\Node $node, int $depth = 2) + function dn(\PhpParser\Node $node, int $depth = 2) : void { \RectorPrefix20210610\dump_node($node, $depth); } @@ -18,9 +15,8 @@ if (!\function_exists('dn')) { if (!\function_exists('dump_node')) { /** * @param Node|Node[] $node - * @return void */ - function dump_node($node, int $depth = 2) + function dump_node($node, int $depth = 2) : void { $nodes = \is_array($node) ? $node : [$node]; foreach ($nodes as $node) { @@ -31,9 +27,8 @@ if (!\function_exists('dump_node')) { if (!\function_exists('print_node')) { /** * @param Node|Node[] $node - * @return void */ - function print_node($node) + function print_node($node) : void { $standard = new \PhpParser\PrettyPrinter\Standard(); $nodes = \is_array($node) ? $node : [$node]; diff --git a/vendor/autoload.php b/vendor/autoload.php index ebe0e27f48e..aa4bf404f74 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1::getLoader(); +return ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 586e9ac5862..ddce166a253 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1 +class ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18 { private static $loader; @@ -22,15 +22,15 @@ class ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); - spl_autoload_unregister(array('ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18', '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\ComposerStaticInitfaabd961586689d08c9910384887bfc1::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18::getInitializer($loader)); } else { $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { @@ -42,19 +42,19 @@ class ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitfaabd961586689d08c9910384887bfc1::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirefaabd961586689d08c9910384887bfc1($fileIdentifier, $file); + composerRequiref1805c4a4acc541bac48b8535ecf6e18($fileIdentifier, $file); } return $loader; } } -function composerRequirefaabd961586689d08c9910384887bfc1($fileIdentifier, $file) +function composerRequiref1805c4a4acc541bac48b8535ecf6e18($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index e58dec7101c..fe120385083 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitfaabd961586689d08c9910384887bfc1 +class ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18 { public static $files = array ( 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', @@ -3876,9 +3876,9 @@ class ComposerStaticInitfaabd961586689d08c9910384887bfc1 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitfaabd961586689d08c9910384887bfc1::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitfaabd961586689d08c9910384887bfc1::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitfaabd961586689d08c9910384887bfc1::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitf1805c4a4acc541bac48b8535ecf6e18::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index dbd69aab698..7c9ca8c755a 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) { spl_autoload_call('RectorPrefix20210610\CheckoutEntityFactory'); } -if (!class_exists('ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1', false) && !interface_exists('ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1', false) && !trait_exists('ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1', false)) { - spl_autoload_call('RectorPrefix20210610\ComposerAutoloaderInitfaabd961586689d08c9910384887bfc1'); +if (!class_exists('ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18', false) && !interface_exists('ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18', false) && !trait_exists('ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18', false)) { + spl_autoload_call('RectorPrefix20210610\ComposerAutoloaderInitf1805c4a4acc541bac48b8535ecf6e18'); } if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) { spl_autoload_call('RectorPrefix20210610\Doctrine\Inflector\Inflector'); @@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) { return \RectorPrefix20210610\print_node(...func_get_args()); } } -if (!function_exists('composerRequirefaabd961586689d08c9910384887bfc1')) { - function composerRequirefaabd961586689d08c9910384887bfc1() { - return \RectorPrefix20210610\composerRequirefaabd961586689d08c9910384887bfc1(...func_get_args()); +if (!function_exists('composerRequiref1805c4a4acc541bac48b8535ecf6e18')) { + function composerRequiref1805c4a4acc541bac48b8535ecf6e18() { + return \RectorPrefix20210610\composerRequiref1805c4a4acc541bac48b8535ecf6e18(...func_get_args()); } } if (!function_exists('parseArgs')) { diff --git a/vendor/symfony/dependency-injection/Attribute/Autoconfigure.php b/vendor/symfony/dependency-injection/Attribute/Autoconfigure.php index 8d759b9d76f..f38863baed2 100644 --- a/vendor/symfony/dependency-injection/Attribute/Autoconfigure.php +++ b/vendor/symfony/dependency-injection/Attribute/Autoconfigure.php @@ -57,15 +57,8 @@ class Autoconfigure /** * @param bool|string|null $lazy * @param mixed[]|string|null $configurator - * @param mixed[]|null $tags - * @param mixed[]|null $calls - * @param mixed[]|null $bind - * @param bool|null $public - * @param bool|null $shared - * @param bool|null $autowire - * @param mixed[]|null $properties */ - public function __construct($tags = null, $calls = null, $bind = null, $lazy = null, $public = null, $shared = null, $autowire = null, $properties = null, $configurator = null) + public function __construct(?array $tags = null, ?array $calls = null, ?array $bind = null, $lazy = null, ?bool $public = null, ?bool $shared = null, ?bool $autowire = null, ?array $properties = null, $configurator = null) { $this->tags = $tags; $this->calls = $calls;