File tree 2 files changed +11
-19
lines changed
2 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ Please also have a look at our
31
31
32
32
### Changed
33
33
34
+ - ` RuleSet::removeRule() ` now only allows ` Rule ` as the parameter
35
+ (implementing classes are ` AtRuleSet ` and ` DeclarationBlock ` );
36
+ use ` removeMatchingRules() ` or ` removeAllRules() ` for other functions (#1255 )
34
37
- ` RuleSet::getRules() ` and ` getRulesAssoc() ` now only allow ` string ` or ` null `
35
38
as the parameter (implementing classes are ` AtRuleSet ` and ` DeclarationBlock ` )
36
39
(#1253 )
Original file line number Diff line number Diff line change @@ -206,28 +206,17 @@ public function getRulesAssoc(?string $searchPattern = null): array
206
206
207
207
/**
208
208
* Removes a `Rule` from this `RuleSet` by identity.
209
- *
210
- * @param Rule|string|null $searchPattern
211
- * `Rule` to remove.
212
- * Passing a `string` or `null` is deprecated in version 8.9.0, and will no longer work from v9.0.
213
- * Use `removeMatchingRules()` or `removeAllRules()` instead.
214
209
*/
215
- public function removeRule ($ searchPattern ): void
210
+ public function removeRule (Rule $ ruleToRemove ): void
216
211
{
217
- if ($ searchPattern instanceof Rule) {
218
- $ nameOfPropertyToRemove = $ searchPattern ->getRule ();
219
- if (!isset ($ this ->rules [$ nameOfPropertyToRemove ])) {
220
- return ;
221
- }
222
- foreach ($ this ->rules [$ nameOfPropertyToRemove ] as $ key => $ rule ) {
223
- if ($ rule === $ searchPattern ) {
224
- unset($ this ->rules [$ nameOfPropertyToRemove ][$ key ]);
225
- }
212
+ $ nameOfPropertyToRemove = $ ruleToRemove ->getRule ();
213
+ if (!isset ($ this ->rules [$ nameOfPropertyToRemove ])) {
214
+ return ;
215
+ }
216
+ foreach ($ this ->rules [$ nameOfPropertyToRemove ] as $ key => $ rule ) {
217
+ if ($ rule === $ ruleToRemove ) {
218
+ unset($ this ->rules [$ nameOfPropertyToRemove ][$ key ]);
226
219
}
227
- } elseif ($ searchPattern !== null ) {
228
- $ this ->removeMatchingRules ($ searchPattern );
229
- } else {
230
- $ this ->removeAllRules ();
231
220
}
232
221
}
233
222
You can’t perform that action at this time.
0 commit comments