Skip to content

Commit b33a1ae

Browse files
committed
[TASK] Raise PHPStan to level 4
Also allow `assertInstanceOf` checks in the tests (as we find those useful).
1 parent 36ed5cd commit b33a1ae

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

config/phpstan-baseline.neon

+30
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ parameters:
66
count: 1
77
path: ../src/CSSList/AtRuleBlockList.php
88

9+
-
10+
message: '#^Call to function is_string\(\) with Sabberworm\\CSS\\Parsing\\ParserState will always evaluate to false\.$#'
11+
identifier: function.impossibleType
12+
count: 1
13+
path: ../src/CSSList/CSSList.php
14+
915
-
1016
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
1117
identifier: notEqual.notAllowed
@@ -36,6 +42,18 @@ parameters:
3642
count: 1
3743
path: ../src/CSSList/Document.php
3844

45+
-
46+
message: '#^Call to function in_array\(\) with arguments null, list\<string\> and true will always evaluate to false\.$#'
47+
identifier: function.impossibleType
48+
count: 1
49+
path: ../src/Parsing/ParserState.php
50+
51+
-
52+
message: '#^Negated boolean expression is always true\.$#'
53+
identifier: booleanNot.alwaysTrue
54+
count: 1
55+
path: ../src/Parsing/ParserState.php
56+
3957
-
4058
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\Value\\RuleValueList\|string\|null given\.$#'
4159
identifier: if.condNotBoolean
@@ -95,3 +113,15 @@ parameters:
95113
identifier: typePerfect.narrowPublicClassMethodParamType
96114
count: 1
97115
path: ../src/Value/Size.php
116+
117+
-
118+
message: '#^Strict comparison using \!\=\= between non\-empty\-string and null will always evaluate to true\.$#'
119+
identifier: notIdentical.alwaysTrue
120+
count: 1
121+
path: ../src/Value/Size.php
122+
123+
-
124+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
125+
identifier: staticMethod.impossibleType
126+
count: 1
127+
path: ../tests/ParserTest.php

config/phpstan.neon

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ parameters:
88

99
phpVersion: 70200
1010

11-
level: 3
11+
level: 4
1212

1313
paths:
1414
- %currentWorkingDirectory%/bin/
@@ -21,3 +21,8 @@ parameters:
2121
null_over_false: true
2222
narrow_param: true
2323
narrow_return: true
24+
25+
ignoreErrors:
26+
-
27+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) .* will always evaluate to#'
28+
path: '../tests/'

0 commit comments

Comments
 (0)