Skip to content

Commit d11477c

Browse files
JakeQZoliverklee
andauthored
[TASK] Deprecate passing Rule to RuleSet::getRules() (#1252)
And also `getRulesAssoc()`. Relates to #1247. This is the backport of #1248. Co-authored-by: Oliver Klee <github@oliverklee.de>
1 parent a14dc83 commit d11477c

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
@@ -33,6 +33,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3333
- Passing a `string` or `null` to `RuleSet::removeRule()` is deprecated
3434
(implementing classes are `AtRuleSet` and `DeclarationBlock`);
3535
use `removeMatchingRules()` or `removeAllRules()` instead (#1249)
36+
- Passing a `Rule` to `RuleSet::getRules()` or `getRulesAssoc()` is deprecated,
37+
affecting the implementing classes `AtRuleSet` and `DeclarationBlock`
38+
(call e.g. `getRules($rule->getRule())` instead) (#1248)
3639
- Passing a string as the first argument to `getAllValues()` is deprecated;
3740
the search pattern should now be passed as the second argument (#1241)
3841
- 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)