Skip to content

Commit e082ab6

Browse files
committed
[CLEANUP] Reformat the code with the PER-2 configuration
1 parent c7eb1c1 commit e082ab6

File tree

4 files changed

+50
-37
lines changed

4 files changed

+50
-37
lines changed

src/RuleSet/DeclarationBlock.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,29 +216,26 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
216216
}
217217

218218
/**
219-
* @see RuleSet::getRules()
220-
*
221219
* @return array<int<0, max>, Rule>
220+
* @see RuleSet::getRules()
222221
*/
223222
public function getRules(?string $searchPattern = null): array
224223
{
225224
return $this->ruleSet->getRules($searchPattern);
226225
}
227226

228227
/**
229-
* @see RuleSet::setRules()
230-
*
231228
* @param array<Rule> $rules
229+
* @see RuleSet::setRules()
232230
*/
233231
public function setRules(array $rules): void
234232
{
235233
$this->ruleSet->setRules($rules);
236234
}
237235

238236
/**
239-
* @see RuleSet::getRulesAssoc()
240-
*
241237
* @return array<string, Rule>
238+
* @see RuleSet::getRulesAssoc()
242239
*/
243240
public function getRulesAssoc(?string $searchPattern = null): array
244241
{

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
@@ -19,21 +19,19 @@ final class OutputFormatTest extends TestCase
1919
* @var string
2020
*/
2121
private const TEST_CSS = <<<EOT
22-
23-
.main, .test {
24-
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
25-
background: white;
26-
}
27-
28-
@media screen {
29-
.main {
30-
background-size: 100% 100%;
31-
font-size: 1.3em;
32-
background-color: #fff;
33-
}
34-
}
35-
36-
EOT;
22+
.main, .test {
23+
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
24+
background: white;
25+
}
26+
27+
@media screen {
28+
.main {
29+
background-size: 100% 100%;
30+
font-size: 1.3em;
31+
background-color: #fff;
32+
}
33+
}
34+
EOT;
3735

3836
/**
3937
* @var Parser
@@ -187,15 +185,18 @@ public function spaceRules(): void
187185
->setSpaceBetweenRules("\n")
188186
->setSpaceAfterRules("\n");
189187

190-
self::assertSame('.main, .test {
188+
self::assertSame(
189+
'.main, .test {
191190
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
192191
background: white;
193192
}
194193
@media screen {.main {
195194
background-size: 100% 100%;
196195
font-size: 1.3em;
197196
background-color: #fff;
198-
}}', $this->document->render($outputFormat));
197+
}}',
198+
$this->document->render($outputFormat)
199+
);
199200
}
200201

201202
/**
@@ -208,12 +209,15 @@ public function spaceBlocks(): void
208209
->setSpaceBetweenBlocks("\n")
209210
->setSpaceAfterBlocks("\n");
210211

211-
self::assertSame('
212+
self::assertSame(
213+
'
212214
.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
213215
@media screen {
214216
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
215217
}
216-
', $this->document->render($outputFormat));
218+
',
219+
$this->document->render($outputFormat)
220+
);
217221
}
218222

219223
/**
@@ -229,7 +233,8 @@ public function spaceBoth(): void
229233
->setSpaceBetweenBlocks("\n")
230234
->setSpaceAfterBlocks("\n");
231235

232-
self::assertSame('
236+
self::assertSame(
237+
'
233238
.main, .test {
234239
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
235240
background: white;
@@ -241,7 +246,9 @@ public function spaceBoth(): void
241246
background-color: #fff;
242247
}
243248
}
244-
', $this->document->render($outputFormat));
249+
',
250+
$this->document->render($outputFormat)
251+
);
245252
}
246253

247254
/**
@@ -273,7 +280,8 @@ public function indentation(): void
273280
->setSpaceAfterBlocks("\n")
274281
->setIndentation('');
275282

276-
self::assertSame('
283+
self::assertSame(
284+
'
277285
.main, .test {
278286
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
279287
background: white;
@@ -285,7 +293,9 @@ public function indentation(): void
285293
background-color: #fff;
286294
}
287295
}
288-
', $this->document->render($outputFormat));
296+
',
297+
$this->document->render($outputFormat)
298+
);
289299
}
290300

291301
/**

tests/ParserTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,10 @@ public function comments(): void
571571
{
572572
$document = self::parsedStructureForFile('comments');
573573
$expected = <<<EXPECTED
574-
@import url("some/url.css") screen;
575-
.foo, #bar {background-color: #000;}
576-
@media screen {#foo.bar {position: absolute;}}
577-
EXPECTED;
574+
@import url("some/url.css") screen;
575+
.foo, #bar {background-color: #000;}
576+
@media screen {#foo.bar {position: absolute;}}
577+
EXPECTED;
578578
self::assertSame($expected, $document->render());
579579
}
580580

0 commit comments

Comments
 (0)