Skip to content

[CLEANUP] Autoformat the code and organize the imports #899

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
Feb 10, 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
12 changes: 6 additions & 6 deletions src/Value/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static function parse(ParserState $parserState, bool $ignoreCase = false)
{
return
$parserState->comes('#')
? self::parseHexColor($parserState)
: self::parseColorFunction($parserState);
? self::parseHexColor($parserState)
: self::parseColorFunction($parserState);
}

/**
Expand Down Expand Up @@ -138,8 +138,8 @@ private static function parseColorFunction(ParserState $parserState): CSSFunctio
// With a `var` argument, the function can have fewer arguments.
// And as of CSS Color Module Level 4, the alpha argument is optional.
$canCloseNow =
$containsVar ||
($mayHaveOptionalAlpha && $argumentIndex >= $expectedArgumentCount - 2);
$containsVar
|| ($mayHaveOptionalAlpha && $argumentIndex >= $expectedArgumentCount - 2);
if ($canCloseNow && $parserState->comes(')')) {
break;
}
Expand Down Expand Up @@ -183,8 +183,8 @@ private static function parseColorFunction(ParserState $parserState): CSSFunctio

return
$containsVar
? new CSSFunction($colorMode, \array_values($colorValues), ',', $parserState->currentLine())
: new Color($colorValues, $parserState->currentLine());
? new CSSFunction($colorMode, \array_values($colorValues), ',', $parserState->currentLine())
: new Color($colorValues, $parserState->currentLine());
}

private static function mapRange(float $value, float $fromMin, float $fromMax, float $toMin, float $toMax): float
Expand Down
8 changes: 4 additions & 4 deletions src/Value/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public static function parseValue(ParserState $parserState, array $aListDelimite
$parserState->consumeWhiteSpace();
//Build a list of delimiters and parsed values
while (
!($parserState->comes('}') || $parserState->comes(';') || $parserState->comes('!')
|| $parserState->comes(')')
|| $parserState->comes('\\')
|| $parserState->isEnd())
!($parserState->comes('}') || $parserState->comes(';') || $parserState->comes('!')
|| $parserState->comes(')')
|| $parserState->comes('\\')
|| $parserState->isEnd())
) {
if (\count($aStack) > 0) {
$bFoundDelimiter = false;
Expand Down
1 change: 0 additions & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Sabberworm\CSS\Value\Color;
use Sabberworm\CSS\Value\Size;
use Sabberworm\CSS\Value\URL;
use Sabberworm\CSS\Value\Value;
use Sabberworm\CSS\Value\ValueList;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Rule/RuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use PHPUnit\Framework\TestCase;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Settings;
use Sabberworm\CSS\Rule\Rule;
use Sabberworm\CSS\Settings;
use Sabberworm\CSS\Value\RuleValueList;
use Sabberworm\CSS\Value\Value;
use Sabberworm\CSS\Value\ValueList;
Expand Down