Skip to content

Commit 5e68f68

Browse files
committed
[CLEANUP] Reformat the code with the PER-2 configuration
Also switch a test string from heredoc to a string literal to avoid the string from getting indented.
1 parent 51a3c0a commit 5e68f68

File tree

3 files changed

+49
-33
lines changed

3 files changed

+49
-33
lines changed

src/RuleSet/DeclarationBlock.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,29 +221,29 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
221221
}
222222

223223
/**
224-
* @see RuleSet::getRules()
225-
*
226224
* @return array<int<0, max>, Rule>
225+
*
226+
* @see RuleSet::getRules()
227227
*/
228228
public function getRules(?string $searchPattern = null): array
229229
{
230230
return $this->ruleSet->getRules($searchPattern);
231231
}
232232

233233
/**
234-
* @see RuleSet::setRules()
235-
*
236234
* @param array<Rule> $rules
235+
*
236+
* @see RuleSet::setRules()
237237
*/
238238
public function setRules(array $rules): void
239239
{
240240
$this->ruleSet->setRules($rules);
241241
}
242242

243243
/**
244-
* @see RuleSet::getRulesAssoc()
245-
*
246244
* @return array<string, Rule>
245+
*
246+
* @see RuleSet::getRulesAssoc()
247247
*/
248248
public function getRulesAssoc(?string $searchPattern = null): array
249249
{

tests/Comment/CommentTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ final class CommentTest extends TestCase
1919
public function keepCommentsInOutput(): void
2020
{
2121
$cssDocument = TestsParserTest::parsedStructureForFile('comments');
22-
self::assertSame('/** Number 11 **/
22+
self::assertSame(
23+
'/** Number 11 **/
2324
2425
/**
2526
* Comments
@@ -43,7 +44,9 @@ public function keepCommentsInOutput(): void
4344
position: absolute;
4445
}
4546
}
46-
', $cssDocument->render(OutputFormat::createPretty()));
47+
',
48+
$cssDocument->render(OutputFormat::createPretty())
49+
);
4750
self::assertSame(
4851
'/** Number 11 **//**' . "\n"
4952
. ' * Comments' . "\n"
@@ -61,7 +64,8 @@ public function keepCommentsInOutput(): void
6164
public function stripCommentsFromOutput(): void
6265
{
6366
$css = TestsParserTest::parsedStructureForFile('comments');
64-
self::assertSame('
67+
self::assertSame(
68+
'
6569
@import url("some/url.css") screen;
6670
6771
.foo, #bar {
@@ -73,7 +77,9 @@ public function stripCommentsFromOutput(): void
7377
position: absolute;
7478
}
7579
}
76-
', $css->render(OutputFormat::createPretty()->setRenderComments(false)));
80+
',
81+
$css->render(OutputFormat::createPretty()->setRenderComments(false))
82+
);
7783
self::assertSame(
7884
'@import url("some/url.css") screen;'
7985
. '.foo,#bar{background-color:#000}'

tests/OutputFormatTest.php

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,19 @@
1616
final class OutputFormatTest extends TestCase
1717
{
1818
private const TEST_CSS = <<<EOT
19-
20-
.main, .test {
21-
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
22-
background: white;
23-
}
24-
25-
@media screen {
26-
.main {
27-
background-size: 100% 100%;
28-
font-size: 1.3em;
29-
background-color: #fff;
30-
}
31-
}
32-
33-
EOT;
19+
.main, .test {
20+
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
21+
background: white;
22+
}
23+
24+
@media screen {
25+
.main {
26+
background-size: 100% 100%;
27+
font-size: 1.3em;
28+
background-color: #fff;
29+
}
30+
}
31+
EOT;
3432

3533
/**
3634
* @var Parser
@@ -184,15 +182,18 @@ public function spaceRules(): void
184182
->setSpaceBetweenRules("\n")
185183
->setSpaceAfterRules("\n");
186184

187-
self::assertSame('.main, .test {
185+
self::assertSame(
186+
'.main, .test {
188187
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
189188
background: white;
190189
}
191190
@media screen {.main {
192191
background-size: 100% 100%;
193192
font-size: 1.3em;
194193
background-color: #fff;
195-
}}', $this->document->render($outputFormat));
194+
}}',
195+
$this->document->render($outputFormat)
196+
);
196197
}
197198

198199
/**
@@ -205,12 +206,15 @@ public function spaceBlocks(): void
205206
->setSpaceBetweenBlocks("\n")
206207
->setSpaceAfterBlocks("\n");
207208

208-
self::assertSame('
209+
self::assertSame(
210+
'
209211
.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
210212
@media screen {
211213
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
212214
}
213-
', $this->document->render($outputFormat));
215+
',
216+
$this->document->render($outputFormat)
217+
);
214218
}
215219

216220
/**
@@ -226,7 +230,8 @@ public function spaceBoth(): void
226230
->setSpaceBetweenBlocks("\n")
227231
->setSpaceAfterBlocks("\n");
228232

229-
self::assertSame('
233+
self::assertSame(
234+
'
230235
.main, .test {
231236
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
232237
background: white;
@@ -238,7 +243,9 @@ public function spaceBoth(): void
238243
background-color: #fff;
239244
}
240245
}
241-
', $this->document->render($outputFormat));
246+
',
247+
$this->document->render($outputFormat)
248+
);
242249
}
243250

244251
/**
@@ -270,7 +277,8 @@ public function indentation(): void
270277
->setSpaceAfterBlocks("\n")
271278
->setIndentation('');
272279

273-
self::assertSame('
280+
self::assertSame(
281+
'
274282
.main, .test {
275283
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
276284
background: white;
@@ -282,7 +290,9 @@ public function indentation(): void
282290
background-color: #fff;
283291
}
284292
}
285-
', $this->document->render($outputFormat));
293+
',
294+
$this->document->render($outputFormat)
295+
);
286296
}
287297

288298
/**

0 commit comments

Comments
 (0)