Skip to content

[TASK ] Remove OutputFormat::set() #1110

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 1 commit into from
Mar 7, 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Please also have a look at our

### Removed

- Remove `OutputFormat::get()` (#1108)
- Remove `OutputFormat::get()` and `::set()` (#1108, #1110)
- Drop special support for vendor prefixes (#1083)
- Remove the IE hack in `Rule` (#995)
- Drop `getLineNo()` from the `Renderable` interface (#1038)
Expand Down
12 changes: 0 additions & 12 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,6 @@ parameters:
count: 2
path: ../src/CSSList/KeyFrame.php

-
message: '#^Returning false in non return bool class method\. Use null with type\|null instead or add bool return type$#'
identifier: typePerfect.nullOverFalse
count: 1
path: ../src/OutputFormat.php

-
message: '#^Variable property access on \$this\(Sabberworm\\CSS\\OutputFormat\)\.$#'
identifier: property.dynamicName
count: 2
path: ../src/OutputFormat.php

-
message: '#^Default value of the parameter \#2 \$bIncludeEnd \(false\) of method Sabberworm\\CSS\\Parsing\\ParserState\:\:consumeUntil\(\) is incompatible with type string\.$#'
identifier: parameter.defaultValue
Expand Down
36 changes: 0 additions & 36 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,42 +182,6 @@ class OutputFormat

public function __construct() {}

/**
* @param array<array-key, string>|string $names
* @param mixed $value
*
* @return self|false
*/
public function set($names, $value)
{
$aVarPrefixes = ['a', 's', 'm', 'b', 'f', 'o', 'c', 'i'];
if (\is_string($names) && \strpos($names, '*') !== false) {
$names =
[
\str_replace('*', 'Before', $names),
\str_replace('*', 'Between', $names),
\str_replace('*', 'After', $names),
];
} elseif (!\is_array($names)) {
$names = [$names];
}
foreach ($aVarPrefixes as $prefix) {
$bDidReplace = false;
foreach ($names as $name) {
$sFieldName = $prefix . \ucfirst($name);
if (isset($this->$sFieldName)) {
$this->$sFieldName = $value;
$bDidReplace = true;
}
}
if ($bDidReplace) {
return $this;
}
}
// Break the chain so the user knows this option is invalid
return false;
}

/**
* @param non-empty-string $sMethodName
* @param array<array-key, mixed> $arguments
Expand Down