Skip to content

Commit bf16950

Browse files
committed
Resolve PHPStan warnings
1 parent ad9cb11 commit bf16950

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

config/phpstan-baseline.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ parameters:
4848
count: 3
4949
path: ../src/Value/Color.php
5050

51+
-
52+
message: '#^Parameter \#2 \$arguments of class Sabberworm\\CSS\\Value\\Expression constructor expects array\<Sabberworm\\CSS\\Value\\Value\|string\>\|Sabberworm\\CSS\\Value\\RuleValueList, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
53+
identifier: argument.type
54+
count: 1
55+
path: ../src/Value/Expression.php
56+
5157
-
5258
message: '#^Parameters should have "float" types as the only types passed to this method$#'
5359
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -107,3 +113,9 @@ parameters:
107113
identifier: argument.type
108114
count: 2
109115
path: ../tests/Unit/CSSList/CSSListTest.php
116+
117+
-
118+
message: '#^Call to an undefined static method Sabberworm\\CSS\\Tests\\Value\\ExpressionTest\:\:listDelimiterForRule\(\)\.$#'
119+
identifier: staticMethod.notFound
120+
count: 1
121+
path: ../tests/Unit/Value/ExpressionTest.php

src/Value/CSSFunction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
class CSSFunction extends ValueList
1818
{
1919
/**
20-
* @var non-empty-string
20+
* @var string
2121
*
2222
* @internal since 8.8.0
2323
*/
2424
protected $name;
2525

2626
/**
27-
* @param non-empty-string $name
27+
* @param string $name
2828
* @param RuleValueList|array<Value|string> $arguments
2929
* @param non-empty-string $separator
3030
* @param int<1, max>|null $lineNumber

src/Value/Expression.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Sabberworm\CSS\Value;
66

77
use Sabberworm\CSS\Parsing\ParserState;
8+
use Sabberworm\CSS\Parsing\SourceException;
89

910
/**
1011
* An `Expression` represents a special kind of value that is comprised of multiple components wrapped in parenthesis.
@@ -14,10 +15,8 @@ class Expression extends CSSFunction
1415
{
1516
/**
1617
* @throws SourceException
17-
* @throws UnexpectedEOFException
18-
* @throws UnexpectedTokenException
1918
*/
20-
public static function parse(ParserState $oParserState, bool $bIgnoreCase = false): Expression
19+
public static function parse(ParserState $oParserState, bool $bIgnoreCase = false): CSSFunction
2120
{
2221
$oParserState->consume('(');
2322
$aArguments = parent::parseArguments($oParserState);

tests/Unit/Value/ExpressionTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
final class ExpressionTest extends TestCase
2020
{
2121
/**
22-
* @return array<0, array{string: string}>
22+
* @return list<array{input: non-empty-string, expected_output: non-empty-string, expression_index: int}>
2323
*/
2424
public static function provideExpressions(): array
2525
{
@@ -54,6 +54,9 @@ public function parseExpressions(string $input, string $expected, int $expressio
5454
self::assertSame($expected, $val->render(OutputFormat::createCompact()));
5555
}
5656

57+
/**
58+
* @return list<non-empty-string>
59+
*/
5760
private function getDelimiters(string $rule): array
5861
{
5962
$closure = function ($rule) {

0 commit comments

Comments
 (0)