Updated Rector to commit 8efa7151e6

8efa7151e6 [FamilyTree] Use parent->hasNativeMethod() on ClassChildAnalyzer->resolveParentClassMethods() (#2357)
This commit is contained in:
Tomas Votruba 2022-05-24 20:58:57 +00:00
parent 5dfc95ba95
commit f3e173b7f3
6 changed files with 46 additions and 38 deletions

View File

@ -58,47 +58,55 @@ CODE_SAMPLE
if ($stmts === null) {
return null;
}
$hasRemovedStmt = \false;
$hasChanged = \false;
$previousStmt = null;
foreach ($stmts as $key => $stmt) {
if (!isset($stmts[$key + 1])) {
continue;
}
if (!$stmt instanceof \PhpParser\Node\Stmt\Expression) {
$previousStmt = $stmt;
continue;
}
$nextStmt = $stmts[$key + 1];
if (!$nextStmt instanceof \PhpParser\Node\Stmt\Expression) {
$expr = $stmt->expr;
if (!$expr instanceof \PhpParser\Node\Expr\Assign) {
$previousStmt = $stmt;
continue;
}
if (!$stmt->expr instanceof \PhpParser\Node\Expr\Assign) {
if (!$expr->var instanceof \PhpParser\Node\Expr\Variable && !$expr->var instanceof \PhpParser\Node\Expr\PropertyFetch && !$expr->var instanceof \PhpParser\Node\Expr\StaticPropertyFetch) {
$previousStmt = $stmt;
continue;
}
if (!$nextStmt->expr instanceof \PhpParser\Node\Expr\Assign) {
if (!$previousStmt instanceof \PhpParser\Node\Stmt\Expression) {
$previousStmt = $stmt;
continue;
}
$nextAssign = $nextStmt->expr;
if (!$this->nodeComparator->areNodesEqual($nextAssign->var, $stmt->expr->var)) {
if (!$previousStmt->expr instanceof \PhpParser\Node\Expr\Assign) {
$previousStmt = $stmt;
continue;
}
$previousAssign = $previousStmt->expr;
if (!$this->nodeComparator->areNodesEqual($previousAssign->var, $expr->var)) {
$previousStmt = $stmt;
continue;
}
// early check self referencing, ensure that variable not re-used
if ($this->isSelfReferencing($nextAssign)) {
if ($this->isSelfReferencing($expr)) {
$previousStmt = $stmt;
continue;
}
// detect call expression has side effect
// no calls on right, could hide e.g. array_pop()|array_shift()
if ($this->sideEffectNodeDetector->detectCallExpr($stmt->expr->expr)) {
if ($this->sideEffectNodeDetector->detectCallExpr($previousAssign->expr)) {
$previousStmt = $stmt;
continue;
}
if (!$stmt->expr->var instanceof \PhpParser\Node\Expr\Variable && !$stmt->expr->var instanceof \PhpParser\Node\Expr\PropertyFetch && !$stmt->expr->var instanceof \PhpParser\Node\Expr\StaticPropertyFetch) {
continue;
}
// remove current Stmt if will be overriden in next stmt
$this->removeNode($stmt);
$hasRemovedStmt = \true;
// remove previous stmt, not current one as the current one is the override
unset($stmts[$key - 1]);
$hasChanged = \true;
}
if (!$hasRemovedStmt) {
if (!$hasChanged) {
return null;
}
\ksort($stmts);
$node->stmts = $stmts;
return $node;
}
private function isSelfReferencing(\PhpParser\Node\Expr\Assign $assign) : bool

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'e1ecbe90fc96be1af3a59ef2312383aa85d5a15d';
public const PACKAGE_VERSION = '8efa7151e64abf2ccdc7a589230d4799f41ed449';
/**
* @var string
*/
public const RELEASE_DATE = '2022-05-24 22:50:15';
public const RELEASE_DATE = '2022-05-24 22:49:28';
/**
* @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 ComposerAutoloaderInit0b8f6740451d5bc7f232a991cca8f361::getLoader();
return ComposerAutoloaderInit8fc9a0c570cf0a4f6cf61adcd9f2fce9::getLoader();

View File

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

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('RectorPrefix20220524\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit0b8f6740451d5bc7f232a991cca8f361', false) && !interface_exists('ComposerAutoloaderInit0b8f6740451d5bc7f232a991cca8f361', false) && !trait_exists('ComposerAutoloaderInit0b8f6740451d5bc7f232a991cca8f361', false)) {
spl_autoload_call('RectorPrefix20220524\ComposerAutoloaderInit0b8f6740451d5bc7f232a991cca8f361');
if (!class_exists('ComposerAutoloaderInit8fc9a0c570cf0a4f6cf61adcd9f2fce9', false) && !interface_exists('ComposerAutoloaderInit8fc9a0c570cf0a4f6cf61adcd9f2fce9', false) && !trait_exists('ComposerAutoloaderInit8fc9a0c570cf0a4f6cf61adcd9f2fce9', false)) {
spl_autoload_call('RectorPrefix20220524\ComposerAutoloaderInit8fc9a0c570cf0a4f6cf61adcd9f2fce9');
}
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('RectorPrefix20220524\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220524\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire0b8f6740451d5bc7f232a991cca8f361')) {
function composerRequire0b8f6740451d5bc7f232a991cca8f361() {
return \RectorPrefix20220524\composerRequire0b8f6740451d5bc7f232a991cca8f361(...func_get_args());
if (!function_exists('composerRequire8fc9a0c570cf0a4f6cf61adcd9f2fce9')) {
function composerRequire8fc9a0c570cf0a4f6cf61adcd9f2fce9() {
return \RectorPrefix20220524\composerRequire8fc9a0c570cf0a4f6cf61adcd9f2fce9(...func_get_args());
}
}
if (!function_exists('scanPath')) {