From 937736f24e567263979adef8bef83aa911f37c32 Mon Sep 17 00:00:00 2001 From: Jake Hotson Date: Thu, 19 Feb 2026 23:38:29 +0000 Subject: [PATCH] [TASK] Use `DeclarationList` in the source code The interface was renamed from `RuleContainer` in #1530. Also rename the trait that transitionally provides a mapping for the methods deprecated in #1521 for the implementing classes. --- CHANGELOG.md | 2 +- src/CSSList/CSSBlockList.php | 4 ++-- src/RuleSet/DeclarationBlock.php | 4 ++-- ...eContainerMethods.php => LegacyDeclarationListMethods.php} | 4 ++-- src/RuleSet/RuleSet.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) rename src/RuleSet/{LegacyRuleContainerMethods.php => LegacyDeclarationListMethods.php} (93%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97620c16..61e27893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ Please also have a look at our ### Changed -- `RuleSet\RuleContainer` is renamed to `RuleSet\DeclarationList` (#1530) +- `RuleSet\RuleContainer` is renamed to `RuleSet\DeclarationList` (#1530, #1539) - Methods like `setRule()` in `RuleSet` and `DeclarationBlock` have been renamed to `setDeclaration()`, etc. (#1521) - `Rule\Rule` class is renamed to `Property\Declaration` diff --git a/src/CSSList/CSSBlockList.php b/src/CSSList/CSSBlockList.php index 574bdaa3..b54a61d8 100644 --- a/src/CSSList/CSSBlockList.php +++ b/src/CSSList/CSSBlockList.php @@ -8,7 +8,7 @@ use Sabberworm\CSS\Property\Declaration; use Sabberworm\CSS\Property\Selector; use Sabberworm\CSS\RuleSet\DeclarationBlock; -use Sabberworm\CSS\RuleSet\RuleContainer; +use Sabberworm\CSS\RuleSet\DeclarationList; use Sabberworm\CSS\RuleSet\RuleSet; use Sabberworm\CSS\Value\CSSFunction; use Sabberworm\CSS\Value\Value; @@ -98,7 +98,7 @@ public function getAllValues( ); } } - } elseif ($element instanceof RuleContainer) { + } elseif ($element instanceof DeclarationList) { foreach ($element->getRules($ruleSearchPattern) as $rule) { $result = \array_merge( $result, diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 29265ca6..6812cb48 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -32,10 +32,10 @@ * * Note that `CSSListItem` extends both `Commentable` and `Renderable`, so those interfaces must also be implemented. */ -class DeclarationBlock implements CSSElement, CSSListItem, Positionable, RuleContainer +class DeclarationBlock implements CSSElement, CSSListItem, Positionable, DeclarationList { use CommentContainer; - use LegacyRuleContainerMethods; + use LegacyDeclarationListMethods; use Position; /** diff --git a/src/RuleSet/LegacyRuleContainerMethods.php b/src/RuleSet/LegacyDeclarationListMethods.php similarity index 93% rename from src/RuleSet/LegacyRuleContainerMethods.php rename to src/RuleSet/LegacyDeclarationListMethods.php index 5ed6f794..2eb82692 100644 --- a/src/RuleSet/LegacyRuleContainerMethods.php +++ b/src/RuleSet/LegacyDeclarationListMethods.php @@ -7,9 +7,9 @@ use Sabberworm\CSS\Property\Declaration; /** - * Provides a mapping of the deprecated methods in a `RuleContainer` to their renamed replacements. + * Provides a mapping of the deprecated methods in a `DeclarationList` to their renamed replacements. */ -trait LegacyRuleContainerMethods +trait LegacyDeclarationListMethods { /** * @deprecated in v9.2, will be removed in v10.0; use `addDeclaration()` instead. diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index f124a2b1..137e8fd4 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -26,10 +26,10 @@ * * Note that `CSSListItem` extends both `Commentable` and `Renderable`, so those interfaces must also be implemented. */ -class RuleSet implements CSSElement, CSSListItem, Positionable, RuleContainer +class RuleSet implements CSSElement, CSSListItem, Positionable, DeclarationList { use CommentContainer; - use LegacyRuleContainerMethods; + use LegacyDeclarationListMethods; use Position; /**