Skip to content
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
6 changes: 0 additions & 6 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ parameters:
count: 1
path: ../tests/ParserTest.php

-
message: '#^Parameter \#1 \$message of static method PHPUnit\\Framework\\Assert\:\:fail\(\) expects string, Exception given\.$#'
identifier: argument.type
count: 1
path: ../tests/ParserTest.php

-
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Size given\.$#'
identifier: argument.type
Expand Down
4 changes: 3 additions & 1 deletion src/Property/Selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Sabberworm\CSS\Property\Selector\SpecificityCalculator;
use Sabberworm\CSS\Renderable;

use function Safe\preg_match;

/**
* Class representing a single CSS selector. Selectors have to be split by the comma prior to being passed into this
* class.
Expand Down Expand Up @@ -57,7 +59,7 @@ class Selector implements Renderable
public static function isValid(string $selector): bool
{
// Note: We need to use `static::` here as the constant is overridden in the `KeyframeSelector` class.
$numberOfMatches = \preg_match(static::SELECTOR_VALIDATION_RX, $selector);
$numberOfMatches = preg_match(static::SELECTOR_VALIDATION_RX, $selector);

return $numberOfMatches === 1;
}
Expand Down
6 changes: 1 addition & 5 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ public function files(): void
continue;
}
$parser = new Parser(\file_get_contents($directory . '/' . $filename));
try {
self::assertNotEquals('', $parser->parse()->render());
} catch (\Exception $e) {
self::fail($e);
}
self::assertNotSame('', $parser->parse()->render());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should fail anyway if an exception is thrown. assertNotSame() is a weaker assertion than assertNotEquals(), but render() can only return a string.

}
\closedir($directoryHandle);
}
Expand Down