Skip to content

Commit da16781

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

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

config/phpstan-baseline.neon

Lines changed: 30 additions & 0 deletions
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
@@ -83,3 +101,15 @@ parameters:
83101
identifier: typePerfect.narrowPublicClassMethodParamType
84102
count: 1
85103
path: ../src/Value/Size.php
104+
105+
-
106+
message: '#^Strict comparison using \!\=\= between non\-empty\-string and null will always evaluate to true\.$#'
107+
identifier: notIdentical.alwaysTrue
108+
count: 1
109+
path: ../src/Value/Size.php
110+
111+
-
112+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
113+
identifier: staticMethod.impossibleType
114+
count: 1
115+
path: ../tests/ParserTest.php

config/phpstan.neon

Lines changed: 6 additions & 1 deletion
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)