Skip to content

[TASK] Deprecate passing Rule to RuleSet::getRules() #1248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[TASK] Deprecate passing Rule to RuleSet::getRules()
And also `getRulesAssoc()`.

Relates to #1247.
  • Loading branch information
JakeQZ committed May 1, 2025
commit 257dc37a388c65e66eaae81a9898f0228956624d
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Please also have a look at our

### 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;
Expand Down
7 changes: 5 additions & 2 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
* 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($rule->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<int<0, max>, Rule>
*/
Expand Down Expand Up @@ -193,7 +194,9 @@ public function setRules(array $rules): void
* @param Rule|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` behaves like calling `getRules($rule->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<string, Rule>
*/
Expand Down