@@ -91,25 +91,22 @@ public function files(): void
9191 public function colorParsing (): void
9292 {
9393 $ document = self ::parsedStructureForFile ('colortest ' );
94- foreach ($ document ->getAllRuleSets () as $ ruleSet ) {
95- if (!($ ruleSet instanceof DeclarationBlock)) {
96- continue ;
97- }
98- $ selectors = $ ruleSet ->getSelectors ();
94+ foreach ($ document ->getAllDeclarationBlocks () as $ declarationBlock ) {
95+ $ selectors = $ declarationBlock ->getSelectors ();
9996 $ selector = $ selectors [0 ]->getSelector ();
10097 if ($ selector === '#mine ' ) {
101- $ colorRules = $ ruleSet ->getRules ('color ' );
98+ $ colorRules = $ declarationBlock ->getRules ('color ' );
10299 $ colorRuleValue = $ colorRules [0 ]->getValue ();
103100 self ::assertSame ('red ' , $ colorRuleValue );
104- $ colorRules = $ ruleSet ->getRules ('background- ' );
101+ $ colorRules = $ declarationBlock ->getRules ('background- ' );
105102 $ colorRuleValue = $ colorRules [0 ]->getValue ();
106103 self ::assertInstanceOf (Color::class, $ colorRuleValue );
107104 self ::assertEquals ([
108105 'r ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
109106 'g ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
110107 'b ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
111108 ], $ colorRuleValue ->getColor ());
112- $ colorRules = $ ruleSet ->getRules ('border-color ' );
109+ $ colorRules = $ declarationBlock ->getRules ('border-color ' );
113110 $ colorRuleValue = $ colorRules [0 ]->getValue ();
114111 self ::assertInstanceOf (Color::class, $ colorRuleValue );
115112 self ::assertEquals ([
@@ -125,7 +122,7 @@ public function colorParsing(): void
125122 'b ' => new Size (231.0 , null , true , $ colorRuleValue ->getLineNumber ()),
126123 'a ' => new Size ('0000.3 ' , null , true , $ colorRuleValue ->getLineNumber ()),
127124 ], $ colorRuleValue ->getColor ());
128- $ colorRules = $ ruleSet ->getRules ('outline-color ' );
125+ $ colorRules = $ declarationBlock ->getRules ('outline-color ' );
129126 $ colorRuleValue = $ colorRules [0 ]->getValue ();
130127 self ::assertInstanceOf (Color::class, $ colorRuleValue );
131128 self ::assertEquals ([
@@ -134,7 +131,7 @@ public function colorParsing(): void
134131 'b ' => new Size (34.0 , null , true , $ colorRuleValue ->getLineNumber ()),
135132 ], $ colorRuleValue ->getColor ());
136133 } elseif ($ selector === '#yours ' ) {
137- $ colorRules = $ ruleSet ->getRules ('background-color ' );
134+ $ colorRules = $ declarationBlock ->getRules ('background-color ' );
138135 $ colorRuleValue = $ colorRules [0 ]->getValue ();
139136 self ::assertInstanceOf (Color::class, $ colorRuleValue );
140137 self ::assertEquals ([
@@ -150,7 +147,7 @@ public function colorParsing(): void
150147 'l ' => new Size (220.0 , '% ' , true , $ colorRuleValue ->getLineNumber ()),
151148 'a ' => new Size (0000.3 , null , true , $ colorRuleValue ->getLineNumber ()),
152149 ], $ colorRuleValue ->getColor ());
153- $ colorRules = $ ruleSet ->getRules ('outline-color ' );
150+ $ colorRules = $ declarationBlock ->getRules ('outline-color ' );
154151 self ::assertEmpty ($ colorRules );
155152 }
156153 }
@@ -179,13 +176,13 @@ public function colorParsing(): void
179176 public function unicodeParsing (): void
180177 {
181178 $ document = self ::parsedStructureForFile ('unicode ' );
182- foreach ($ document ->getAllDeclarationBlocks () as $ ruleSet ) {
183- $ selectors = $ ruleSet ->getSelectors ();
179+ foreach ($ document ->getAllDeclarationBlocks () as $ declarationBlock ) {
180+ $ selectors = $ declarationBlock ->getSelectors ();
184181 $ selector = $ selectors [0 ]->getSelector ();
185182 if (\substr ($ selector , 0 , \strlen ('.test- ' )) !== '.test- ' ) {
186183 continue ;
187184 }
188- $ contentRules = $ ruleSet ->getRules ('content ' );
185+ $ contentRules = $ declarationBlock ->getRules ('content ' );
189186 $ firstContentRuleAsString = $ contentRules [0 ]->getValue ()->render (OutputFormat::create ());
190187 if ($ selector === '.test-1 ' ) {
191188 self ::assertSame ('" " ' , $ firstContentRuleAsString );
0 commit comments