Updated Rector to commit 6e9783c671158782b2477af6b504475b133705f6

6e9783c671 [Downgrade Php 8] Handle Property Fetch and static Property fetch (#195)
This commit is contained in:
Tomas Votruba 2021-06-10 13:15:41 +00:00
parent 4e4ad99d9a
commit 6d40eadfb2
8 changed files with 38 additions and 39 deletions

View File

@ -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;
}
}

View File

@ -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__);

View File

@ -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];

2
vendor/autoload.php vendored
View File

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

View File

@ -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;

View File

@ -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);
}

View File

@ -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')) {

View File

@ -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;