Skip to content

[TASK] Only allow string for some OutputFormat properties #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Please also have a look at our

### Changed

- Only allow `string` for some `OutputFormat` properties (#885)
- Make all non-private properties `@internal` (#886)
- Use more native type declarations and strict mode
(#641, #772, #774, #778, #804, #841, #873, #875)
Expand Down
18 changes: 4 additions & 14 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ class OutputFormat
/**
* This is what’s inserted before the separator in value lists, by default.
*
* `array` is deprecated in version 8.8.0, and will be removed in version 9.0.0.
* To set the spacing for specific separators, use {@see $aSpaceBeforeListArgumentSeparators} instead.
*
* @var string|array<non-empty-string, string>
* @var string
*
* @internal since 8.8.0, will be made private in 9.0.0
*/
Expand All @@ -145,10 +142,7 @@ class OutputFormat
/**
* This is what’s inserted after the separator in value lists, by default.
*
* `array` is deprecated in version 8.8.0, and will be removed in version 9.0.0.
* To set the spacing for specific separators, use {@see $aSpaceAfterListArgumentSeparators} instead.
*
* @var string|array<non-empty-string, string>
* @var string
*
* @internal since 8.8.0, will be made private in 9.0.0
*/
Expand Down Expand Up @@ -597,21 +591,17 @@ public function setSpaceBeforeListArgumentSeparators(array $separatorSpaces): se
}

/**
* @return string|array<non-empty-string, string>
*
* @internal
*/
public function getSpaceAfterListArgumentSeparator()
public function getSpaceAfterListArgumentSeparator(): string
{
return $this->sSpaceAfterListArgumentSeparator;
}

/**
* @param string|array<non-empty-string, string> $whitespace
*
* @return $this fluent interface
*/
public function setSpaceAfterListArgumentSeparator($whitespace): self
public function setSpaceAfterListArgumentSeparator(string $whitespace): self
{
$this->sSpaceAfterListArgumentSeparator = $whitespace;

Expand Down
20 changes: 0 additions & 20 deletions tests/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,6 @@ public function spaceAfterListArgumentSeparator(): void
);
}

/**
* @test
*
* @deprecated since version 8.8.0; will be removed in version 9.0.
* Use `setSpaceAfterListArgumentSeparators()` to set different spacing per separator.
*/
public function spaceAfterListArgumentSeparatorComplexDeprecated(): void
{
self::assertSame(
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;background: white;}'
. "\n@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}",
$this->document->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator([
'default' => ' ',
',' => "\t",
'/' => '',
' ' => '',
]))
);
}

/**
* @test
*/
Expand Down