diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index adc53dd4085..9af295747be 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '3806bb8f05a822d081a69f735745ae2f14caf657'; + public const PACKAGE_VERSION = '18436f1f44262a6dcc0dcb6d5bb88eb439a53045'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-06-18 16:40:15'; + public const RELEASE_DATE = '2023-06-18 17:45:05'; /** * @var int */ diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 7773b44cae8..a521309d273 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -155,14 +155,14 @@ final class PropertyManipulator return \true; } $propertyFetches = $this->propertyFetchFinder->findPrivatePropertyFetches($class, $propertyOrParam); + $classMethod = $class->getMethod(MethodName::CONSTRUCT); foreach ($propertyFetches as $propertyFetch) { if ($this->isChangeableContext($propertyFetch, $scope)) { return \true; } // skip for constructor? it is allowed to set value in constructor method $propertyName = (string) $this->nodeNameResolver->getName($propertyFetch); - $classMethod = $this->betterNodeFinder->findParentType($propertyFetch, ClassMethod::class); - if ($this->isPropertyAssignedOnlyInConstructor($class, $propertyName, $classMethod)) { + if ($this->isPropertyAssignedOnlyInConstructor($class, $propertyName, $propertyFetch, $classMethod)) { continue; } if ($this->assignManipulator->isLeftPartOfAssign($propertyFetch)) { @@ -209,13 +209,19 @@ final class PropertyManipulator } 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) { 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 - if (!$this->nodeNameResolver->isName($classMethod->name, MethodName::CONSTRUCT)) { + if (!$node instanceof Node) { return \false; } return $this->constructorAssignDetector->isPropertyAssigned($class, $propertyName); diff --git a/vendor/autoload.php b/vendor/autoload.php index 18d3078419b..8923d27e5ad 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389::getLoader(); +return ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index c7e3e525332..2610e09bdbb 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389 +class ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389 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__)); - spl_autoload_unregister(array('ComposerAutoloaderInitcf1d947e9768c34d09a4e46d10546389', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitbb2ba2a619778f3c7e218eb9b59b79e3', 'loadClassLoader')); 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->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 17a5b3eef12..80830d41bff 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitcf1d947e9768c34d09a4e46d10546389 +class ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3095,9 +3095,9 @@ class ComposerStaticInitcf1d947e9768c34d09a4e46d10546389 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitcf1d947e9768c34d09a4e46d10546389::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitbb2ba2a619778f3c7e218eb9b59b79e3::$classMap; }, null, ClassLoader::class); }