Skip to content

Commit 53b3148

Browse files
committed
[TASK] Deprecate passing Rule to RuleSet::getRules()
And also `getRulesAssoc()`. Relates to #1247. This is the backport of #1248.
1 parent f5fc39a commit 53b3148

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
@@ -26,6 +26,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2626

2727
### Deprecated
2828

29+
- Passing a `Rule` to `RuleSet::getRules()` or `getRulesAssoc()` is deprecated,
30+
affecting the implementing classes `AtRuleSet` and `DeclarationBlock`
31+
(call e.g. `getRules($rule->getRule())` instead) (#1248)
2932
- Passing a string as the first argument to `getAllValues()` is deprecated;
3033
the search pattern should now be passed as the second argument (#1241)
3134
- 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
@@ -146,7 +146,8 @@ public function addRule(Rule $oRule, $oSibling = null)
146146
* Pattern to search for. If null, returns all rules.
147147
* If the pattern ends with a dash, all rules starting with the pattern are returned
148148
* as well as one matching the pattern with the dash excluded.
149-
* Passing a Rule behaves like calling `getRules($mRule->getRule())`.
149+
* Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0.
150+
* Call `getRules($rule->getRule())` instead.
150151
*
151152
* @return array<int, Rule>
152153
*/
@@ -205,7 +206,9 @@ public function setRules(array $aRules)
205206
* @param Rule|string|null $mRule $mRule
206207
* Pattern to search for. If null, returns all rules. If the pattern ends with a dash,
207208
* all rules starting with the pattern are returned as well as one matching the pattern with the dash
208-
* excluded. Passing a Rule behaves like calling `getRules($mRule->getRule())`.
209+
* excluded.
210+
* Passing a `Rule` for this parameter is deprecated in version 8.9.0, and will not work from v9.0.
211+
* Call `getRulesAssoc($rule->getRule())` instead.
209212
*
210213
* @return array<string, Rule>
211214
*/

0 commit comments

Comments
 (0)