From 53b31483a6ceb7d9c85a909d8e6e952676e1216c Mon Sep 17 00:00:00 2001 From: JakeQZ Date: Fri, 2 May 2025 10:30:08 +0100 Subject: [PATCH] [TASK] Deprecate passing `Rule` to `RuleSet::getRules()` And also `getRulesAssoc()`. Relates to #1247. This is the backport of #1248. --- CHANGELOG.md | 3 +++ src/RuleSet/RuleSet.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b08c38a2..5cab98f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,9 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Deprecated +- Passing a `Rule` to `RuleSet::getRules()` or `getRulesAssoc()` is deprecated, + affecting the implementing classes `AtRuleSet` and `DeclarationBlock` + (call e.g. `getRules($rule->getRule())` instead) (#1248) - Passing a string as the first argument to `getAllValues()` is deprecated; the search pattern should now be passed as the second argument (#1241) - Passing a Boolean as the second argument to `getAllValues()` is deprecated; diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 12b8157a..ff225e41 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -146,7 +146,8 @@ public function addRule(Rule $oRule, $oSibling = null) * 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 behaves like calling `getRules($mRule->getRule())`. + * 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 */ @@ -205,7 +206,9 @@ public function setRules(array $aRules) * @param Rule|string|null $mRule $mRule * 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 behaves like calling `getRules($mRule->getRule())`. + * 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 */