Skip to content

Commit 9a829cb

Browse files
committed
[TASK] Deprecate passing Rule to RuleSet::getRules()
And also `getRulesAssoc`. Relates to #1247.
1 parent 9dbc6a6 commit 9a829cb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Please also have a look at our
4646

4747
### Deprecated
4848

49+
- Passing a `Rule` to `RuleSet::getRules()` or `getRulesAssoc()` is deprecated,
50+
affecting the implementing classes `AtRuleSet` and `DeclarationBlock`
51+
(call e.g. `getRules($rule->getRule())` instead) (#1248)
4952
- Passing a string as the first argument to `getAllValues()` is deprecated;
5053
the search pattern should now be passed as the second argument (#1241)
5154
- Passing a Boolean as the second argument to `getAllValues()` is deprecated;

src/RuleSet/RuleSet.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
135135
* Pattern to search for. If null, returns all rules.
136136
* If the pattern ends with a dash, all rules starting with the pattern are returned
137137
* as well as one matching the pattern with the dash excluded.
138-
* Passing a `Rule` behaves like calling `getRules($rule->getRule())`.
138+
* Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0.
139+
* Call `getRules($rule->getRule())` instead.
139140
*
140141
* @return array<int<0, max>, Rule>
141142
*/
@@ -193,7 +194,9 @@ public function setRules(array $rules): void
193194
* @param Rule|string|null $searchPattern
194195
* Pattern to search for. If null, returns all rules. If the pattern ends with a dash,
195196
* all rules starting with the pattern are returned as well as one matching the pattern with the dash
196-
* excluded. Passing a `Rule` behaves like calling `getRules($rule->getRule())`.
197+
* excluded.
198+
* Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0.
199+
* Call `getRulesAssoc($rule->getRule())` instead.
197200
*
198201
* @return array<string, Rule>
199202
*/

0 commit comments

Comments
 (0)