File tree Expand file tree Collapse file tree 2 files changed +11
-19
lines changed Expand file tree Collapse file tree 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
3131
3232### Changed
3333
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 )
3437- ` RuleSet::getRules() ` and ` getRulesAssoc() ` now only allow ` string ` or ` null `
3538 as the parameter (implementing classes are ` AtRuleSet ` and ` DeclarationBlock ` )
3639 (#1253 )
Original file line number Diff line number Diff line change @@ -206,28 +206,17 @@ public function getRulesAssoc(?string $searchPattern = null): array
206206
207207 /**
208208 * 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.
214209 */
215- public function removeRule ($ searchPattern ): void
210+ public function removeRule (Rule $ ruleToRemove ): void
216211 {
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 ]);
226219 }
227- } elseif ($ searchPattern !== null ) {
228- $ this ->removeMatchingRules ($ searchPattern );
229- } else {
230- $ this ->removeAllRules ();
231220 }
232221 }
233222
You can’t perform that action at this time.
0 commit comments