mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 18436f1f44262a6dcc0dcb6d5bb88eb439a53045
18436f1f44
[NodeManipulator] Remove parent lookup on PropertyManipulator (#4274)
This commit is contained in:
parent
ed58f0fcb1
commit
ad1bdeeb0f
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '3806bb8f05a822d081a69f735745ae2f14caf657';
|
public const PACKAGE_VERSION = '18436f1f44262a6dcc0dcb6d5bb88eb439a53045';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-06-18 16:40:15';
|
public const RELEASE_DATE = '2023-06-18 17:45:05';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
@ -155,14 +155,14 @@ final class PropertyManipulator
|
|||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
$propertyFetches = $this->propertyFetchFinder->findPrivatePropertyFetches($class, $propertyOrParam);
|
$propertyFetches = $this->propertyFetchFinder->findPrivatePropertyFetches($class, $propertyOrParam);
|
||||||
|
$classMethod = $class->getMethod(MethodName::CONSTRUCT);
|
||||||
foreach ($propertyFetches as $propertyFetch) {
|
foreach ($propertyFetches as $propertyFetch) {
|
||||||
if ($this->isChangeableContext($propertyFetch, $scope)) {
|
if ($this->isChangeableContext($propertyFetch, $scope)) {
|
||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
// skip for constructor? it is allowed to set value in constructor method
|
// skip for constructor? it is allowed to set value in constructor method
|
||||||
$propertyName = (string) $this->nodeNameResolver->getName($propertyFetch);
|
$propertyName = (string) $this->nodeNameResolver->getName($propertyFetch);
|
||||||
$classMethod = $this->betterNodeFinder->findParentType($propertyFetch, ClassMethod::class);
|
if ($this->isPropertyAssignedOnlyInConstructor($class, $propertyName, $propertyFetch, $classMethod)) {
|
||||||
if ($this->isPropertyAssignedOnlyInConstructor($class, $propertyName, $classMethod)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($this->assignManipulator->isLeftPartOfAssign($propertyFetch)) {
|
if ($this->assignManipulator->isLeftPartOfAssign($propertyFetch)) {
|
||||||
@ -209,13 +209,19 @@ final class PropertyManipulator
|
|||||||
}
|
}
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
private function isPropertyAssignedOnlyInConstructor(Class_ $class, string $propertyName, ?ClassMethod $classMethod) : bool
|
/**
|
||||||
|
* @param \PhpParser\Node\Expr\StaticPropertyFetch|\PhpParser\Node\Expr\PropertyFetch $propertyFetch
|
||||||
|
*/
|
||||||
|
private function isPropertyAssignedOnlyInConstructor(Class_ $class, string $propertyName, $propertyFetch, ?ClassMethod $classMethod) : bool
|
||||||
{
|
{
|
||||||
if (!$classMethod instanceof ClassMethod) {
|
if (!$classMethod instanceof ClassMethod) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
|
$node = $this->betterNodeFinder->findFirst((array) $classMethod->stmts, static function (Node $subNode) use($propertyFetch) : bool {
|
||||||
|
return ($subNode instanceof PropertyFetch || $subNode instanceof StaticPropertyFetch) && $subNode === $propertyFetch;
|
||||||
|
});
|
||||||
// there is property unset in Test class, so only check on __construct
|
// there is property unset in Test class, so only check on __construct
|
||||||
if (!$this->nodeNameResolver->isName($classMethod->name, MethodName::CONSTRUCT)) {
|
if (!$node instanceof Node) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
return $this->constructorAssignDetector->isPropertyAssigned($class, $propertyName);
|
return $this->constructorAssignDetector->isPropertyAssigned($class, $propertyName);
|
||||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389::getLoader();
|
return ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3::getLoader();
|
||||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389
|
class ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInitcf1d947e9768c34d09a4e46d10546389
|
class ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -3095,9 +3095,9 @@ class ComposerStaticInitcf1d947e9768c34d09a4e46d10546389
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$classMap;
|
$loader->classMap = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user