diff --git a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php index f776342b6c9..7d481871dd5 100644 --- a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php +++ b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php @@ -202,7 +202,7 @@ private function isPromotedProperty(Class_ $class, string $propertyName) : bool $constructClassMethod = $class->getMethod(MethodName::CONSTRUCT); if ($constructClassMethod instanceof ClassMethod) { foreach ($constructClassMethod->params as $param) { - if (!$param->flags) { + if (!$param->isPromoted()) { continue; } $paramName = $this->getName($param->var); diff --git a/rules/DeadCode/NodeCollector/UnusedParameterResolver.php b/rules/DeadCode/NodeCollector/UnusedParameterResolver.php index a63b30b8f61..4f6e2b63eb1 100644 --- a/rules/DeadCode/NodeCollector/UnusedParameterResolver.php +++ b/rules/DeadCode/NodeCollector/UnusedParameterResolver.php @@ -26,7 +26,7 @@ public function resolve(ClassMethod $classMethod) : array foreach ($classMethod->params as $i => $param) { // skip property promotion /** @var Param $param */ - if ($param->flags !== 0) { + if ($param->isPromoted()) { continue; } if ($this->paramAnalyzer->isParamUsedInClassMethod($classMethod, $param)) { diff --git a/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php b/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php index fffb40fa9a6..a127364ae6d 100644 --- a/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php @@ -82,7 +82,7 @@ public function getNodeTypes() : array public function refactor(Node $node) : ?Node { // for param, only on property promotion - if ($node instanceof Param && $node->flags === 0) { + if ($node instanceof Param && !$node->isPromoted()) { return null; } if (!$this->visibilityManipulator->isReadonly($node)) { diff --git a/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php b/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php index 1295dda57a8..4f0d02208ab 100644 --- a/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php +++ b/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php @@ -89,7 +89,7 @@ public function renamePropertyPromotion($classLike) : bool // resolve possible and existing param names $blockingParamNames = $this->resolveBlockingParamNames($constructClassMethod); foreach ($constructClassMethod->params as $param) { - if ($param->flags === 0) { + if (!$param->isPromoted()) { continue; } // promoted property diff --git a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php index 69350991e4a..55ee751fd35 100644 --- a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php +++ b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php @@ -129,6 +129,6 @@ private function shouldSkipParam(Param $param, string $expectedName, $classMetho if (!$this->isName($classMethod, MethodName::CONSTRUCT)) { return \false; } - return $param->flags !== 0; + return $param->isPromoted(); } } diff --git a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php index 6cb466fd1ea..4869fadedd6 100644 --- a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php +++ b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php @@ -150,7 +150,7 @@ private function isParamUsedBeforeAssign(Variable $variable, array $firstParamAs private function shouldSkipParam(Param $matchedParam, Variable $assignedVariable, array $firstParamAsVariable) : bool { // already promoted - if ($matchedParam->flags !== 0) { + if ($matchedParam->isPromoted()) { return \true; } return $this->isParamUsedBeforeAssign($assignedVariable, $firstParamAsVariable); diff --git a/rules/Php80/NodeAnalyzer/PromotedPropertyResolver.php b/rules/Php80/NodeAnalyzer/PromotedPropertyResolver.php index 8876bb45f59..d9e4ca4ed14 100644 --- a/rules/Php80/NodeAnalyzer/PromotedPropertyResolver.php +++ b/rules/Php80/NodeAnalyzer/PromotedPropertyResolver.php @@ -20,7 +20,7 @@ public function resolveFromClass(Class_ $class) : array } $promotedPropertyParams = []; foreach ($constructClassMethod->getParams() as $param) { - if ($param->flags === 0) { + if (!$param->isPromoted()) { continue; } $promotedPropertyParams[] = $param; diff --git a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php index 27ddbb4f408..457035c96d9 100644 --- a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php +++ b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php @@ -215,7 +215,7 @@ private function refactorParam(Class_ $class, ClassMethod $classMethod, Param $p return null; } // early check not property promotion and already readonly - if ($param->flags === 0 || $this->visibilityManipulator->isReadonly($param)) { + if (!$param->isPromoted() || $this->visibilityManipulator->isReadonly($param)) { return null; } if ($this->propertyManipulator->isPropertyChangeableExceptConstructor($class, $param, $scope)) { @@ -243,7 +243,7 @@ private function isPromotedPropertyAssigned(Class_ $class, Param $param) : bool if (!$constructClassMethod instanceof ClassMethod) { return \false; } - if ($param->flags === 0) { + if (!$param->isPromoted()) { return \false; } $propertyFetch = new PropertyFetch(new Variable('this'), $this->getName($param)); diff --git a/rules/Php82/Rector/Class_/ReadOnlyClassRector.php b/rules/Php82/Rector/Class_/ReadOnlyClassRector.php index 9b11f854bb1..6148dc414f9 100644 --- a/rules/Php82/Rector/Class_/ReadOnlyClassRector.php +++ b/rules/Php82/Rector/Class_/ReadOnlyClassRector.php @@ -262,7 +262,7 @@ private function shouldSkipParams(array $params) : bool { foreach ($params as $param) { // has non-readonly property promotion - if (!$this->visibilityManipulator->hasVisibility($param, Visibility::READONLY) && $param->flags !== 0) { + if (!$this->visibilityManipulator->hasVisibility($param, Visibility::READONLY) && $param->isPromoted()) { return \true; } // type is missing, invalid syntax diff --git a/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php b/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php index 5c5ee4947f6..f76cb7c4422 100644 --- a/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php +++ b/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php @@ -88,7 +88,7 @@ public function refactor(Node $node) : ?Node $construct = $node->getMethod(MethodName::CONSTRUCT); if ($construct instanceof ClassMethod) { foreach ($construct->params as $param) { - if ($param->flags === 0) { + if (!$param->isPromoted()) { continue; } if (!$this->visibilityManipulator->hasVisibility($param, Visibility::PROTECTED)) { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 15d76d1a38c..5be84ae31f7 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 = '3f5a86eacf0e245bb683a32afe422901dee44006'; + public const PACKAGE_VERSION = '8ed98c17688300b3aa85d978fefc24c88a51f1f3'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-01-05 00:35:03'; + public const RELEASE_DATE = '2025-01-05 11:09:27'; /** * @var int */ diff --git a/src/NodeAnalyzer/ParamAnalyzer.php b/src/NodeAnalyzer/ParamAnalyzer.php index df8e201f272..9942e0ace0b 100644 --- a/src/NodeAnalyzer/ParamAnalyzer.php +++ b/src/NodeAnalyzer/ParamAnalyzer.php @@ -88,7 +88,7 @@ public function isParamUsedInClassMethod(ClassMethod $classMethod, Param $param) public function hasPropertyPromotion(array $params) : bool { foreach ($params as $param) { - if ($param->flags !== 0) { + if ($param->isPromoted()) { return \true; } } diff --git a/src/PhpParser/AstResolver.php b/src/PhpParser/AstResolver.php index 73f3f62d10d..023d2a753e3 100644 --- a/src/PhpParser/AstResolver.php +++ b/src/PhpParser/AstResolver.php @@ -324,7 +324,7 @@ private function findPromotedPropertyByName(array $stmts, string $desiredClassNa return \false; } foreach ($constructClassMethod->getParams() as $param) { - if ($param->flags === 0) { + if (!$param->isPromoted()) { continue; } if ($this->nodeNameResolver->isName($param, $desiredPropertyName)) {