Skip to content

Commit ebc7061

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 c7eb1c1 commit ebc7061

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

src/RuleSet/DeclarationBlock.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,29 +216,29 @@ 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+
*
221+
* @see RuleSet::getRules()
222222
*/
223223
public function getRules(?string $searchPattern = null): array
224224
{
225225
return $this->ruleSet->getRules($searchPattern);
226226
}
227227

228228
/**
229-
* @see RuleSet::setRules()
230-
*
231229
* @param array<Rule> $rules
230+
*
231+
* @see RuleSet::setRules()
232232
*/
233233
public function setRules(array $rules): void
234234
{
235235
$this->ruleSet->setRules($rules);
236236
}
237237

238238
/**
239-
* @see RuleSet::getRulesAssoc()
240-
*
241239
* @return array<string, Rule>
240+
*
241+
* @see RuleSet::getRulesAssoc()
242242
*/
243243
public function getRulesAssoc(?string $searchPattern = null): array
244244
{

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: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ final class OutputFormatTest extends TestCase
1818
/**
1919
* @var string
2020
*/
21-
private const TEST_CSS = <<<EOT
22-
21+
private const TEST_CSS = '
2322
.main, .test {
2423
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
2524
background: white;
@@ -32,8 +31,7 @@ final class OutputFormatTest extends TestCase
3231
background-color: #fff;
3332
}
3433
}
35-
36-
EOT;
34+
';
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)