Skip to content

Commit 515488b

Browse files
committed
[CLEANUP] Reformat the code with the PER-2 configuration
1 parent 00f637f commit 515488b

File tree

5 files changed

+50
-31
lines changed

5 files changed

+50
-31
lines changed

src/Comment/Comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace Sabberworm\CSS\Comment;
66

77
use Sabberworm\CSS\OutputFormat;
8-
use Sabberworm\CSS\Renderable;
98
use Sabberworm\CSS\Position\Position;
109
use Sabberworm\CSS\Position\Positionable;
10+
use Sabberworm\CSS\Renderable;
1111

1212
class Comment implements Positionable, Renderable
1313
{

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: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
final class OutputFormatTest extends TestCase
1717
{
1818
private const TEST_CSS = "\n"
19-
. ".main, .test {\n"
20-
. "\tfont: italic normal bold 16px/1.2 \"Helvetica\", Verdana, sans-serif;\n"
21-
. "\tbackground: white;\n"
22-
. "}\n"
23-
. "\n"
24-
. "@media screen {\n"
25-
. "\t.main {\n"
26-
. "\t\tbackground-size: 100% 100%;\n"
27-
. "\t\tfont-size: 1.3em;\n"
28-
. "\t\tbackground-color: #fff;\n"
29-
. "\t}\n"
30-
. "}\n";
19+
. ".main, .test {\n"
20+
. "\tfont: italic normal bold 16px/1.2 \"Helvetica\", Verdana, sans-serif;\n"
21+
. "\tbackground: white;\n"
22+
. "}\n"
23+
. "\n"
24+
. "@media screen {\n"
25+
. "\t.main {\n"
26+
. "\t\tbackground-size: 100% 100%;\n"
27+
. "\t\tfont-size: 1.3em;\n"
28+
. "\t\tbackground-color: #fff;\n"
29+
. "\t}\n"
30+
. "}\n";
3131

3232
/**
3333
* @var Parser
@@ -181,15 +181,18 @@ public function spaceRules(): void
181181
->setSpaceBetweenRules("\n")
182182
->setSpaceAfterRules("\n");
183183

184-
self::assertSame('.main, .test {
184+
self::assertSame(
185+
'.main, .test {
185186
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
186187
background: white;
187188
}
188189
@media screen {.main {
189190
background-size: 100% 100%;
190191
font-size: 1.3em;
191192
background-color: #fff;
192-
}}', $this->document->render($outputFormat));
193+
}}',
194+
$this->document->render($outputFormat)
195+
);
193196
}
194197

195198
/**
@@ -202,12 +205,15 @@ public function spaceBlocks(): void
202205
->setSpaceBetweenBlocks("\n")
203206
->setSpaceAfterBlocks("\n");
204207

205-
self::assertSame('
208+
self::assertSame(
209+
'
206210
.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
207211
@media screen {
208212
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
209213
}
210-
', $this->document->render($outputFormat));
214+
',
215+
$this->document->render($outputFormat)
216+
);
211217
}
212218

213219
/**
@@ -223,7 +229,8 @@ public function spaceBoth(): void
223229
->setSpaceBetweenBlocks("\n")
224230
->setSpaceAfterBlocks("\n");
225231

226-
self::assertSame('
232+
self::assertSame(
233+
'
227234
.main, .test {
228235
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
229236
background: white;
@@ -235,7 +242,9 @@ public function spaceBoth(): void
235242
background-color: #fff;
236243
}
237244
}
238-
', $this->document->render($outputFormat));
245+
',
246+
$this->document->render($outputFormat)
247+
);
239248
}
240249

241250
/**
@@ -267,7 +276,8 @@ public function indentation(): void
267276
->setSpaceAfterBlocks("\n")
268277
->setIndentation('');
269278

270-
self::assertSame('
279+
self::assertSame(
280+
'
271281
.main, .test {
272282
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
273283
background: white;
@@ -279,7 +289,9 @@ public function indentation(): void
279289
background-color: #fff;
280290
}
281291
}
282-
', $this->document->render($outputFormat));
292+
',
293+
$this->document->render($outputFormat)
294+
);
283295
}
284296

285297
/**

tests/Unit/Value/CalcFunctionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function parseSimpleCalc(): void
4747
self::assertSame(20.0, $components[2]->getSize());
4848
self::assertSame('px', $components[2]->getUnit());
4949
}
50+
5051
/**
5152
* @test
5253
*/

0 commit comments

Comments
 (0)