From 7d52cf2cddfaad252c9c5dd0be0c5c18f6b62832 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 8 Sep 2024 10:53:32 +0000 Subject: [PATCH] Updated Rector to commit 1ebb7aa29bfff54059d455ee6f908fa47a7416c3 https://github.com/rectorphp/rector-src/commit/1ebb7aa29bfff54059d455ee6f908fa47a7416c3 [CodeQuality] Allow transform static to self on final class on ConvertStaticPrivateConstantToSelfRector (#6295) --- .../ConvertStaticPrivateConstantToSelfRector.php | 12 ++++-------- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/rules/CodeQuality/Rector/ClassConstFetch/ConvertStaticPrivateConstantToSelfRector.php b/rules/CodeQuality/Rector/ClassConstFetch/ConvertStaticPrivateConstantToSelfRector.php index 117296ad5334..984158265bff 100644 --- a/rules/CodeQuality/Rector/ClassConstFetch/ConvertStaticPrivateConstantToSelfRector.php +++ b/rules/CodeQuality/Rector/ClassConstFetch/ConvertStaticPrivateConstantToSelfRector.php @@ -66,7 +66,10 @@ public function refactor(Node $node) : ?Class_ if (!$node instanceof ClassConstFetch) { return null; } - if ($this->shouldBeSkipped($class, $node)) { + if (!$this->isUsingStatic($node)) { + return null; + } + if (!$class->isFinal() && !$this->isPrivateConstant($node, $class)) { return null; } $hasChanged = \true; @@ -96,13 +99,6 @@ private function isPrivateConstant(ClassConstFetch $classConstFetch, Class_ $cla } return \false; } - private function shouldBeSkipped(Class_ $class, ClassConstFetch $classConstFetch) : bool - { - if (!$this->isUsingStatic($classConstFetch)) { - return \true; - } - return !$this->isPrivateConstant($classConstFetch, $class); - } private function getConstantName(ClassConstFetch $classConstFetch) : ?string { $constantNameIdentifier = $classConstFetch->name; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index a61e51f884f3..d1f216744617 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 = '393423fd3c87f1e915f252f8316f1616b623c320'; + public const PACKAGE_VERSION = '1ebb7aa29bfff54059d455ee6f908fa47a7416c3'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-09-08 01:36:56'; + public const RELEASE_DATE = '2024-09-08 17:51:18'; /** * @var int */