diff --git a/CHANGELOG.md b/CHANGELOG.md index f31a4a61..12fd4c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Removed - Drop support for PHP < 7.2 (#420) +- Final removal of Document::getAllSelectors (#557) +- Final removal of Rule::setValues (#557) +- Final removal of Rule::getValues (#557) +- Final removal of DeclarationBlock::setSelector (#557) +- Final removal of DeclarationBlock::getSelector (#557) ### Fixed diff --git a/src/CSSList/Document.php b/src/CSSList/Document.php index bad99831..917186b4 100644 --- a/src/CSSList/Document.php +++ b/src/CSSList/Document.php @@ -50,18 +50,6 @@ public function getAllDeclarationBlocks() return $aResult; } - /** - * Gets all `DeclarationBlock` objects recursively. - * - * @return array - * - * @deprecated will be removed in version 9.0; use `getAllDeclarationBlocks()` instead - */ - public function getAllSelectors() - { - return $this->getAllDeclarationBlocks(); - } - /** * Returns all `RuleSet` objects recursively found in the tree, no matter how deeply nested the rule sets are. * diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index 2c56f7de..37ed89d3 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -189,79 +189,6 @@ public function setValue($mValue) $this->mValue = $mValue; } - /** - * @param array> $aSpaceSeparatedValues - * - * @return RuleValueList - * - * @deprecated will be removed in version 9.0 - * Old-Style 2-dimensional array given. Retained for (some) backwards-compatibility. - * Use `setValue()` instead and wrap the value inside a RuleValueList if necessary. - */ - public function setValues(array $aSpaceSeparatedValues) - { - $oSpaceSeparatedList = null; - if (count($aSpaceSeparatedValues) > 1) { - $oSpaceSeparatedList = new RuleValueList(' ', $this->iLineNo); - } - foreach ($aSpaceSeparatedValues as $aCommaSeparatedValues) { - $oCommaSeparatedList = null; - if (count($aCommaSeparatedValues) > 1) { - $oCommaSeparatedList = new RuleValueList(',', $this->iLineNo); - } - foreach ($aCommaSeparatedValues as $mValue) { - if (!$oSpaceSeparatedList && !$oCommaSeparatedList) { - $this->mValue = $mValue; - return $mValue; - } - if ($oCommaSeparatedList) { - $oCommaSeparatedList->addListComponent($mValue); - } else { - $oSpaceSeparatedList->addListComponent($mValue); - } - } - if (!$oSpaceSeparatedList) { - $this->mValue = $oCommaSeparatedList; - return $oCommaSeparatedList; - } else { - $oSpaceSeparatedList->addListComponent($oCommaSeparatedList); - } - } - $this->mValue = $oSpaceSeparatedList; - return $oSpaceSeparatedList; - } - - /** - * @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. diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 23716724..af900f79 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -146,29 +146,6 @@ public function removeSelector($mSelector) return false; } - /** - * @return array - * - * @deprecated will be removed in version 9.0; use `getSelectors()` instead - */ - public function getSelector() - { - return $this->getSelectors(); - } - - /** - * @param Selector|string $mSelector - * @param CSSList|null $oList - * - * @return void - * - * @deprecated will be removed in version 9.0; use `setSelectors()` instead - */ - public function setSelector($mSelector, $oList = null) - { - $this->setSelectors($mSelector, $oList); - } - /** * @return array */ 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); }