@@ -91,25 +91,22 @@ public function files(): void
91
91
public function colorParsing (): void
92
92
{
93
93
$ 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 ();
99
96
$ selector = $ selectors [0 ]->getSelector ();
100
97
if ($ selector === '#mine ' ) {
101
- $ colorRules = $ ruleSet ->getRules ('color ' );
98
+ $ colorRules = $ declarationBlock ->getRules ('color ' );
102
99
$ colorRuleValue = $ colorRules [0 ]->getValue ();
103
100
self ::assertSame ('red ' , $ colorRuleValue );
104
- $ colorRules = $ ruleSet ->getRules ('background- ' );
101
+ $ colorRules = $ declarationBlock ->getRules ('background- ' );
105
102
$ colorRuleValue = $ colorRules [0 ]->getValue ();
106
103
self ::assertInstanceOf (Color::class, $ colorRuleValue );
107
104
self ::assertEquals ([
108
105
'r ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
109
106
'g ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
110
107
'b ' => new Size (35.0 , null , true , $ colorRuleValue ->getLineNumber ()),
111
108
], $ colorRuleValue ->getColor ());
112
- $ colorRules = $ ruleSet ->getRules ('border-color ' );
109
+ $ colorRules = $ declarationBlock ->getRules ('border-color ' );
113
110
$ colorRuleValue = $ colorRules [0 ]->getValue ();
114
111
self ::assertInstanceOf (Color::class, $ colorRuleValue );
115
112
self ::assertEquals ([
@@ -125,7 +122,7 @@ public function colorParsing(): void
125
122
'b ' => new Size (231.0 , null , true , $ colorRuleValue ->getLineNumber ()),
126
123
'a ' => new Size ('0000.3 ' , null , true , $ colorRuleValue ->getLineNumber ()),
127
124
], $ colorRuleValue ->getColor ());
128
- $ colorRules = $ ruleSet ->getRules ('outline-color ' );
125
+ $ colorRules = $ declarationBlock ->getRules ('outline-color ' );
129
126
$ colorRuleValue = $ colorRules [0 ]->getValue ();
130
127
self ::assertInstanceOf (Color::class, $ colorRuleValue );
131
128
self ::assertEquals ([
@@ -134,7 +131,7 @@ public function colorParsing(): void
134
131
'b ' => new Size (34.0 , null , true , $ colorRuleValue ->getLineNumber ()),
135
132
], $ colorRuleValue ->getColor ());
136
133
} elseif ($ selector === '#yours ' ) {
137
- $ colorRules = $ ruleSet ->getRules ('background-color ' );
134
+ $ colorRules = $ declarationBlock ->getRules ('background-color ' );
138
135
$ colorRuleValue = $ colorRules [0 ]->getValue ();
139
136
self ::assertInstanceOf (Color::class, $ colorRuleValue );
140
137
self ::assertEquals ([
@@ -150,7 +147,7 @@ public function colorParsing(): void
150
147
'l ' => new Size (220.0 , '% ' , true , $ colorRuleValue ->getLineNumber ()),
151
148
'a ' => new Size (0000.3 , null , true , $ colorRuleValue ->getLineNumber ()),
152
149
], $ colorRuleValue ->getColor ());
153
- $ colorRules = $ ruleSet ->getRules ('outline-color ' );
150
+ $ colorRules = $ declarationBlock ->getRules ('outline-color ' );
154
151
self ::assertEmpty ($ colorRules );
155
152
}
156
153
}
@@ -179,13 +176,13 @@ public function colorParsing(): void
179
176
public function unicodeParsing (): void
180
177
{
181
178
$ document = self ::parsedStructureForFile ('unicode ' );
182
- foreach ($ document ->getAllDeclarationBlocks () as $ ruleSet ) {
183
- $ selectors = $ ruleSet ->getSelectors ();
179
+ foreach ($ document ->getAllDeclarationBlocks () as $ declarationBlock ) {
180
+ $ selectors = $ declarationBlock ->getSelectors ();
184
181
$ selector = $ selectors [0 ]->getSelector ();
185
182
if (\substr ($ selector , 0 , \strlen ('.test- ' )) !== '.test- ' ) {
186
183
continue ;
187
184
}
188
- $ contentRules = $ ruleSet ->getRules ('content ' );
185
+ $ contentRules = $ declarationBlock ->getRules ('content ' );
189
186
$ firstContentRuleAsString = $ contentRules [0 ]->getValue ()->render (OutputFormat::create ());
190
187
if ($ selector === '.test-1 ' ) {
191
188
self ::assertSame ('" " ' , $ firstContentRuleAsString );
0 commit comments