Skip to content

Commit 2d6ead6

Browse files
authored
Merge branch 'main' into task/remove-atruleargs
2 parents d40fa16 + 13f1ff5 commit 2d6ead6

File tree

10 files changed

+29
-57
lines changed

10 files changed

+29
-57
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Please also have a look at our
3333
- Make all non-private properties `@internal` (#886)
3434
- Use more native type declarations and strict mode
3535
(#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958,
36-
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141)
36+
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145)
3737
- Add visibility to all class/interface constants (#469)
3838

3939
### Deprecated

config/phpstan-baseline.neon

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:comments\(\)\.$#'
5-
identifier: method.notFound
6-
count: 1
7-
path: ../src/CSSList/AtRuleBlockList.php
8-
9-
-
10-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeOpeningBrace\(\)\.$#'
11-
identifier: method.notFound
12-
count: 1
13-
path: ../src/CSSList/AtRuleBlockList.php
14-
153
-
164
message: '#^Only booleans are allowed in an if condition, string given\.$#'
175
identifier: if.condNotBoolean
@@ -144,18 +132,6 @@ parameters:
144132
count: 1
145133
path: ../src/Property/Import.php
146134

147-
-
148-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:comments\(\)\.$#'
149-
identifier: method.notFound
150-
count: 1
151-
path: ../src/Rule/Rule.php
152-
153-
-
154-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterRuleName\(\)\.$#'
155-
identifier: method.notFound
156-
count: 1
157-
path: ../src/Rule/Rule.php
158-
159135
-
160136
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\Value\\RuleValueList\|string\|null given\.$#'
161137
identifier: if.condNotBoolean
@@ -371,21 +347,3 @@ parameters:
371347
identifier: typePerfect.narrowPublicClassMethodParamType
372348
count: 1
373349
path: ../src/Value/Size.php
374-
375-
-
376-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:implode\(\)\.$#'
377-
identifier: method.notFound
378-
count: 1
379-
path: ../src/Value/ValueList.php
380-
381-
-
382-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterListArgumentSeparator\(\)\.$#'
383-
identifier: method.notFound
384-
count: 1
385-
path: ../src/Value/ValueList.php
386-
387-
-
388-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeListArgumentSeparator\(\)\.$#'
389-
identifier: method.notFound
390-
count: 1
391-
path: ../src/Value/ValueList.php

src/CSSList/AtRuleBlockList.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class AtRuleBlockList extends CSSBlockList implements AtRule
1414
{
1515
/**
16-
* @var string
16+
* @var non-empty-string
1717
*/
1818
private $type;
1919

@@ -23,6 +23,7 @@ class AtRuleBlockList extends CSSBlockList implements AtRule
2323
private $arguments;
2424

2525
/**
26+
* @param non-empty-string $type
2627
* @param int<0, max> $lineNumber
2728
*/
2829
public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
@@ -32,6 +33,9 @@ public function __construct(string $type, string $arguments = '', int $lineNumbe
3233
$this->arguments = $arguments;
3334
}
3435

36+
/**
37+
* @return non-empty-string
38+
*/
3539
public function atRuleName(): string
3640
{
3741
return $this->type;
@@ -52,13 +56,14 @@ public function __toString(): string
5256

5357
public function render(OutputFormat $outputFormat): string
5458
{
55-
$result = $outputFormat->comments($this);
59+
$formatter = $outputFormat->getFormatter();
60+
$result = $formatter->comments($this);
5661
$result .= $outputFormat->getContentBeforeAtRuleBlock();
5762
$arguments = $this->arguments;
5863
if ($arguments) {
5964
$arguments = ' ' . $arguments;
6065
}
61-
$result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
66+
$result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
6267
$result .= $this->renderListContents($outputFormat);
6368
$result .= '}';
6469
$result .= $outputFormat->getContentAfterAtRuleBlock();

src/Property/AtRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface AtRule extends Renderable, Commentable
2020
public const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
2121

2222
/**
23-
* @return string|null
23+
* @return non-empty-string
2424
*/
25-
public function atRuleName();
25+
public function atRuleName(): string;
2626
}

src/Property/CSSNamespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function setPrefix($prefix): void
101101
}
102102

103103
/**
104-
* @return string
104+
* @return non-empty-string
105105
*/
106106
public function atRuleName(): string
107107
{

src/Property/Charset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function render(OutputFormat $outputFormat): string
8484
return "{$outputFormat->comments($this)}@charset {$this->charset->render($outputFormat)};";
8585
}
8686

87+
/**
88+
* @return non-empty-string
89+
*/
8790
public function atRuleName(): string
8891
{
8992
return 'charset';

src/Property/Import.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public function render(OutputFormat $outputFormat): string
8686
. ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
8787
}
8888

89+
/**
90+
* @return non-empty-string
91+
*/
8992
public function atRuleName(): string
9093
{
9194
return 'import';

src/Rule/Rule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ public function __toString(): string
234234

235235
public function render(OutputFormat $outputFormat): string
236236
{
237-
$result = "{$outputFormat->comments($this)}{$this->rule}:{$outputFormat->spaceAfterRuleName()}";
237+
$formatter = $outputFormat->getFormatter();
238+
$result = "{$formatter->comments($this)}{$this->rule}:{$formatter->spaceAfterRuleName()}";
238239
if ($this->value instanceof Value) { // Can also be a ValueList
239240
$result .= $this->value->render($outputFormat);
240241
} else {

src/RuleSet/AtRuleSet.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class AtRuleSet extends RuleSet implements AtRule
1717
{
1818
/**
19-
* @var string
19+
* @var non-empty-string
2020
*/
2121
private $type;
2222

@@ -26,7 +26,7 @@ class AtRuleSet extends RuleSet implements AtRule
2626
private $arguments;
2727

2828
/**
29-
* @param string $type
29+
* @param non-empty-string $type
3030
* @param string $arguments
3131
* @param int<0, max> $lineNumber
3232
*/
@@ -38,9 +38,9 @@ public function __construct($type, $arguments = '', int $lineNumber = 0)
3838
}
3939

4040
/**
41-
* @return string
41+
* @return non-empty-string
4242
*/
43-
public function atRuleName()
43+
public function atRuleName(): string
4444
{
4545
return $this->type;
4646
}

src/Value/ValueList.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ public function __toString(): string
9393

9494
public function render(OutputFormat $outputFormat): string
9595
{
96-
return $outputFormat->implode(
97-
$outputFormat->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
98-
. $outputFormat->spaceAfterListArgumentSeparator($this->separator),
96+
$formatter = $outputFormat->getFormatter();
97+
98+
return $formatter->implode(
99+
$formatter->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
100+
. $formatter->spaceAfterListArgumentSeparator($this->separator),
99101
$this->components
100102
);
101103
}

0 commit comments

Comments
 (0)