From 1f90f6a820c23f219b0834b51ff69af59a422496 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Tue, 18 Jun 2024 11:16:38 +0200 Subject: [PATCH 1/2] [TASK] Remove Rule::getValues Signed-off-by: Daniel Ziegenberg --- CHANGELOG.md | 1 + src/Rule/Rule.php | 31 ------------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9030e80..0adf598b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Removed +- Final removal of `Rule::getValues()` (#582) - Remove `Rule::setValues()` (#562) - Remove `Document::getAllSelectors()` (#561) - Remove `DeclarationBlock::getSelector()` (#559) diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index aecb6bf8..37ed89d3 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -189,37 +189,6 @@ public function setValue($mValue) $this->mValue = $mValue; } - /** - * @return array> - * - * @deprecated will be removed in version 9.0 - * Old-Style 2-dimensional array returned. Retained for (some) backwards-compatibility. - * Use `getValue()` instead and check for the existence of a (nested set of) ValueList object(s). - */ - public function getValues(): array - { - if (!$this->mValue instanceof RuleValueList) { - return [[$this->mValue]]; - } - if ($this->mValue->getListSeparator() === ',') { - return [$this->mValue->getListComponents()]; - } - $aResult = []; - foreach ($this->mValue->getListComponents() as $mValue) { - if (!$mValue instanceof RuleValueList || $mValue->getListSeparator() !== ',') { - $aResult[] = [$mValue]; - continue; - } - if ($this->mValue->getListSeparator() === ' ' || count($aResult) === 0) { - $aResult[] = []; - } - foreach ($mValue->getListComponents() as $mValue) { - $aResult[count($aResult) - 1][] = $mValue; - } - } - return $aResult; - } - /** * Adds a value to the existing value. Value will be appended if a `RuleValueList` exists of the given type. * Otherwise, the existing value will be wrapped by one. From dd2ee4d93a56ccce740944ffc989311434794b6c Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Tue, 18 Jun 2024 09:43:23 +0200 Subject: [PATCH 2/2] [TASK] Fix tests after removing Rule::getValues Signed-off-by: Daniel Ziegenberg --- CHANGELOG.md | 2 +- tests/ParserTest.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0adf598b..38fc67e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Removed -- Final removal of `Rule::getValues()` (#582) +- Remove `Rule::getValues()` (#582) - Remove `Rule::setValues()` (#562) - Remove `Document::getAllSelectors()` (#561) - Remove `DeclarationBlock::getSelector()` (#559) diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 91cd283c..06640910 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -182,8 +182,7 @@ public function unicodeParsing(): void continue; } $aContentRules = $oRuleSet->getRules('content'); - $aContents = $aContentRules[0]->getValues(); - $sString = $aContents[0][0]->__toString(); + $sString = $aContentRules[0]->getValue()->__toString(); if ($sSelector == '.test-1') { self::assertSame('" "', $sString); }