Skip to content

Commit 0a37763

Browse files
authored
[TASK] Use Declaration::getPropertyName() in RuleSet (#1519)
This method replaces `getRule()`, which is deprecated as of #1506.
1 parent fd15e78 commit 0a37763

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Please also have a look at our
3535
- `Rule\Rule` class is deprecated; `Property\Declaration` is a direct
3636
replacement (#1508)
3737
- `Rule::setRule()` and `getRule()` are deprecated and replaced with
38-
`setPropertyName()` and `getPropertyName()` (#1506)
38+
`setPropertyName()` and `getPropertyName()` (#1506, #1519)
3939

4040
### Removed
4141

src/RuleSet/RuleSet.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function parseRuleSet(ParserState $parserState, RuleSet $ruleSet):
101101
*/
102102
public function addRule(Declaration $declarationToAdd, ?Declaration $sibling = null): void
103103
{
104-
$propertyName = $declarationToAdd->getRule();
104+
$propertyName = $declarationToAdd->getPropertyName();
105105
if (!isset($this->declarations[$propertyName])) {
106106
$this->declarations[$propertyName] = [];
107107
}
@@ -240,7 +240,7 @@ public function getRulesAssoc(?string $searchPattern = null): array
240240
/** @var array<string, Declaration> $result */
241241
$result = [];
242242
foreach ($this->getRules($searchPattern) as $declaration) {
243-
$result[$declaration->getRule()] = $declaration;
243+
$result[$declaration->getPropertyName()] = $declaration;
244244
}
245245

246246
return $result;
@@ -251,7 +251,7 @@ public function getRulesAssoc(?string $searchPattern = null): array
251251
*/
252252
public function removeRule(Declaration $declarationToRemove): void
253253
{
254-
$nameOfPropertyToRemove = $declarationToRemove->getRule();
254+
$nameOfPropertyToRemove = $declarationToRemove->getPropertyName();
255255
if (!isset($this->declarations[$nameOfPropertyToRemove])) {
256256
return;
257257
}

0 commit comments

Comments
 (0)