diff --git a/CHANGELOG.md b/CHANGELOG.md index 023117c69..7ed3cf5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ Please also have a look at our ### Changed +- `RuleSet::getRules()` and `getRulesAssoc()` now only allow `string` or `null` + as the parameter (implementing classes are `AtRuleSet` and `DeclarationBlock`) + (#1253) - Parameters for `getAllValues()` are deconflated, so it now takes three (all optional), allowing `$element` and `$ruleSearchPattern` to be specified separately (#1241) diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 3ed5cf0f3..e3cd629a9 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -131,20 +131,15 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void * @example $ruleSet->getRules('font-') * //returns an array of all rules either beginning with font- or matching font. * - * @param Rule|string|null $searchPattern + * @param string|null $searchPattern * Pattern to search for. If null, returns all rules. * If the pattern ends with a dash, all rules starting with the pattern are returned * as well as one matching the pattern with the dash excluded. - * Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0. - * Call `getRules($rule->getRule())` instead. * * @return array, Rule> */ - public function getRules($searchPattern = null): array + public function getRules(?string $searchPattern = null): array { - if ($searchPattern instanceof Rule) { - $searchPattern = $searchPattern->getRule(); - } $result = []; foreach ($this->rules as $propertyName => $rules) { // Either no search rule is given or the search rule matches the found rule exactly @@ -191,16 +186,14 @@ public function setRules(array $rules): void * like `{ background-color: green; background-color; rgba(0, 127, 0, 0.7); }` will only yield an associative array * containing the rgba-valued rule while `getRules()` would yield an indexed array containing both. * - * @param Rule|string|null $searchPattern + * @param string|null $searchPattern * Pattern to search for. If null, returns all rules. If the pattern ends with a dash, * all rules starting with the pattern are returned as well as one matching the pattern with the dash * excluded. - * Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0. - * Call `getRulesAssoc($rule->getRule())` instead. * * @return array */ - public function getRulesAssoc($searchPattern = null): array + public function getRulesAssoc(?string $searchPattern = null): array { /** @var array $result */ $result = [];