Skip to content

[TASK] Remove Rule::setValues #562

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

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Removed

- Remove `Rule::setValues()` (#562)
- Remove `Document::getAllSelectors()` (#561)
- Remove `DeclarationBlock::getSelector()` (#559)
- Remove `DeclarationBlock::setSelector()` (#560)
Expand Down
42 changes: 0 additions & 42 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,48 +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>>
*
Expand Down