8000 [TASK] Only allow `string` for some `OutputFormat` properties (#885) · MyIntervals/PHP-CSS-Parser@c630248 · GitHub
Skip to content

Commit c630248

Browse files
authored
[TASK] Only allow string for some OutputFormat properties (#885)
`sBeforeAfterListArgumentSeparator` and `sSpaceAfterListArgumentSeparator` now can only hold strings, and no longer arrays (which was deprecated in V8.8.0).
1 parent f7914f8 commit c630248

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Please also have a look at our
2121

2222
### Changed
2323

24+
- Only allow `string` for some `OutputFormat` properties (#885)
2425
- Make all non-private properties `@internal` (#886)
2526
- Use more native type declarations and strict mode
2627
(#641, #772, #774, #778, #804, #841, #873, #875)

src/OutputFormat.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ class OutputFormat
124124
/**
125125
* This is what’s inserted before the separator in value lists, by default.
126126
*
127-
* `array` is deprecated in version 8.8.0, and will be removed in version 9.0.0.
128-
* To set the spacing for specific separators, use {@see $aSpaceBeforeListArgumentSeparators} instead.
129-
*
130-
* @var string|array<non-empty-string, string>
127+ 10000
* @var string
131128
*
132129
* @internal since 8.8.0, will be made private in 9.0.0
133130
*/
@@ -145,10 +142,7 @@ class OutputFormat
145142
/**
146143
* This is what’s inserted after the separator in value lists, by default.
147144
*
148-
* `array` is deprecated in version 8.8.0, and will be removed in version 9.0.0.
149-
* To set the spacing for specific separators, use {@see $aSpaceAfterListArgumentSeparators} instead.
150-
*
151-
* @var string|array<non-empty-string, string>
145+
* @var string
152146
*
153147
* @internal since 8.8.0, will be made private in 9.0.0
154148
*/
@@ -597,21 +591,17 @@ public function setSpaceBeforeListArgumentSeparators(array $separatorSpaces): se
597591
}
598592

599593
/**
600-
* @return string|array<non-empty-string, string>
601-
*
602594
* @internal
603595
*/
604-
public function getSpaceAfterListArgumentSeparator()
596+
public function getSpaceAfterListArgumentSeparator(): string
605597
{
606598
return $this->sSpaceAfterListArgumentSeparator;
607599
}
608600

609601
/**
610-
* @param string|array<non-empty-string, string> $whitespace
611-
*
612602
* @return $this fluent interface
613603
*/
614-
public function setSpaceAfterListArgumentSeparator($whitespace): self
604+
public function setSpaceAfterListArgumentSeparator(string $whitespace): self
615605
{
616606
$this->sSpaceAfterListArgumentSeparator = $whitespace;
617607

tests/OutputFormatTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,6 @@ public function spaceAfterListArgumentSeparator(): void
9696
);
9797
}
9898

99-
/**
100-
* @test
101-
*
102-
* @deprecated since version 8.8.0; will be removed in version 9.0.
103-
* Use `setSpaceAfterListArgumentSeparators()` to set different spacing per separator.
104-
*/
105-
public function spaceAfterListArgumentSeparatorComplexDeprecated(): void
106-
{
107-
self::assertSame(
108-
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;background: white;}'
109-
. "\n@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}",
110-
$this->document->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator([
111-
'default' => ' ',
112-
',' => "\t",
113-
'/' => '',
114-
' ' => '',
115-
]))
116-
);
117-
}
118-
11999
/**
120100
* @test
121101
*/

0 commit comments

Comments
 (0)