Skip to content

[CLEANUP] Final removal of deprecated functions #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[CLEANUP] Final removal of deprecated functions (#557)
Final removal of:
- Document::getAllSelectors
- Rule::setValues
- Rule::getValues
- DeclarationBlock::setSelector
- DeclarationBlock::getSelector

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
  • Loading branch information
ziegenberg committed Jun 17, 2024
commit 062a5b2207bd548dd0a8bcedb67c65cb211f6b8b
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 0 additions & 12 deletions src/CSSList/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@ public function getAllDeclarationBlocks()
return $aResult;
}

/**
* Gets all `DeclarationBlock` objects recursively.
*
* @return array<int, DeclarationBlock>
*
* @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.
*
Expand Down
73 changes: 0 additions & 73 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,79 +189,6 @@ public function setValue($mValue)
$this->mValue = $mValue;
}

/**
* @param array<array-key, array<array-key, RuleValueList>> $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<int, array<int, RuleValueList>>
*
* @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.
Expand Down
23 changes: 0 additions & 23 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,6 @@ public function removeSelector($mSelector)
return false;
}

/**
* @return array<int, Selector|string>
*
* @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<int, Selector|string>
*/
Expand Down
Loading