From d82c8817163c9d67d5696b8adb08fdfd69a8cfd0 Mon Sep 17 00:00:00 2001 From: Jake Hotson Date: Fri, 13 Feb 2026 23:24:37 +0000 Subject: [PATCH] [TASK] Use `Declaration::getPropertyName()` in `RuleSet` This method replaces `getRule()`, which is deprecated as of #1506. --- CHANGELOG.md | 2 +- src/RuleSet/RuleSet.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f209a96..a8f3b599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ Please also have a look at our - `Rule\Rule` class is deprecated; `Property\Declaration` is a direct replacement (#1508) - `Rule::setRule()` and `getRule()` are deprecated and replaced with - `setPropertyName()` and `getPropertyName()` (#1506) + `setPropertyName()` and `getPropertyName()` (#1506, #1519) ### Removed diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 2d6d9393..6be349ea 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -101,7 +101,7 @@ public static function parseRuleSet(ParserState $parserState, RuleSet $ruleSet): */ public function addRule(Declaration $declarationToAdd, ?Declaration $sibling = null): void { - $propertyName = $declarationToAdd->getRule(); + $propertyName = $declarationToAdd->getPropertyName(); if (!isset($this->declarations[$propertyName])) { $this->declarations[$propertyName] = []; } @@ -240,7 +240,7 @@ public function getRulesAssoc(?string $searchPattern = null): array /** @var array $result */ $result = []; foreach ($this->getRules($searchPattern) as $declaration) { - $result[$declaration->getRule()] = $declaration; + $result[$declaration->getPropertyName()] = $declaration; } return $result; @@ -251,7 +251,7 @@ public function getRulesAssoc(?string $searchPattern = null): array */ public function removeRule(Declaration $declarationToRemove): void { - $nameOfPropertyToRemove = $declarationToRemove->getRule(); + $nameOfPropertyToRemove = $declarationToRemove->getPropertyName(); if (!isset($this->declarations[$nameOfPropertyToRemove])) { return; }