Skip to content

Commit e6c3b55

Browse files
committed
[TASK] Raise PHPStan to level 7
https://phpstan.org/user-guide/rule-levels
1 parent dbddfc3 commit e6c3b55

File tree

2 files changed

+217
-1
lines changed

2 files changed

+217
-1
lines changed

config/phpstan-baseline.neon

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@ parameters:
66
count: 1
77
path: ../src/CSSList/CSSList.php
88

9+
-
10+
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\CSSList\\CSSListItem\|false given\.$#'
11+
identifier: if.condNotBoolean
12+
count: 1
13+
path: ../src/CSSList/CSSList.php
14+
15+
-
16+
message: '#^Parameter \#1 \$animationName of method Sabberworm\\CSS\\CSSList\\KeyFrame\:\:setAnimationName\(\) expects non\-empty\-string, string given\.$#'
17+
identifier: argument.type
18+
count: 1
19+
path: ../src/CSSList/CSSList.php
20+
921
-
1022
message: '#^Parameter \#2 \$found of class Sabberworm\\CSS\\Parsing\\UnexpectedTokenException constructor expects string, Sabberworm\\CSS\\Value\\CSSFunction\|Sabberworm\\CSS\\Value\\CSSString\|Sabberworm\\CSS\\Value\\LineName\|Sabberworm\\CSS\\Value\\Size\|Sabberworm\\CSS\\Value\\URL given\.$#'
1123
identifier: argument.type
1224
count: 1
1325
path: ../src/CSSList/CSSList.php
1426

27+
-
28+
message: '#^Parameter \#2 \$found of class Sabberworm\\CSS\\Parsing\\UnexpectedTokenException constructor expects string, Sabberworm\\CSS\\Value\\CSSFunction\|Sabberworm\\CSS\\Value\\LineName\|Sabberworm\\CSS\\Value\\Size\|string given\.$#'
29+
identifier: argument.type
30+
count: 1
31+
path: ../src/CSSList/CSSList.php
32+
1533
-
1634
message: '#^Parameters should have "Sabberworm\\CSS\\CSSList\\CSSListItem\|array" types as the only types passed to this method$#'
1735
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -24,18 +42,90 @@ parameters:
2442
count: 1
2543
path: ../src/CSSList/Document.php
2644

45+
-
46+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:parseIdentifier\(\) should return non\-empty\-string but returns string\.$#'
47+
identifier: return.type
48+
count: 1
49+
path: ../src/Parsing/ParserState.php
50+
51+
-
52+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:strlen\(\) should return int\<0, max\> but returns int\<0, max\>\|false\.$#'
53+
identifier: return.type
54+
count: 1
55+
path: ../src/Parsing/ParserState.php
56+
2757
-
2858
message: '#^Negated boolean expression is always true\.$#'
2959
identifier: booleanNot.alwaysTrue
3060
count: 1
3161
path: ../src/Parsing/ParserState.php
3262

63+
-
64+
message: '#^Property Sabberworm\\CSS\\Parsing\\ParserState\:\:\$currentPosition \(int\<0, max\>\) does not accept int\.$#'
65+
identifier: assign.propertyType
66+
count: 2
67+
path: ../src/Parsing/ParserState.php
68+
69+
-
70+
message: '#^Only numeric types are allowed in \*, int\<0, max\>\|false\|null given on the left side\.$#'
71+
identifier: mul.leftNonNumeric
72+
count: 1
73+
path: ../src/Property/Selector/SpecificityCalculator.php
74+
75+
-
76+
message: '#^Only numeric types are allowed in \+, int\<0, max\>\|false\|null given on the right side\.$#'
77+
identifier: plus.rightNonNumeric
78+
count: 1
79+
path: ../src/Property/Selector/SpecificityCalculator.php
80+
81+
-
82+
message: '#^Only booleans are allowed in an if condition, int\|false given\.$#'
83+
identifier: if.condNotBoolean
84+
count: 1
85+
path: ../src/Rule/Rule.php
86+
87+
-
88+
message: '#^Parameter \#1 \$separator of class Sabberworm\\CSS\\Value\\RuleValueList constructor expects non\-empty\-string, string given\.$#'
89+
identifier: argument.type
90+
count: 1
91+
path: ../src/Rule/Rule.php
92+
93+
-
94+
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
95+
identifier: argument.type
96+
count: 1
97+
path: ../src/Rule/Rule.php
98+
99+
-
100+
message: '#^Cannot call method getSelector\(\) on Sabberworm\\CSS\\Property\\Selector\|string\.$#'
101+
identifier: method.nonObject
102+
count: 1
103+
path: ../src/RuleSet/DeclarationBlock.php
104+
105+
-
106+
message: '#^Method Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:getSelectors\(\) should return array\<Sabberworm\\CSS\\Property\\Selector\> but returns array\<Sabberworm\\CSS\\Property\\Selector\|string\>\.$#'
107+
identifier: return.type
108+
count: 1
109+
path: ../src/RuleSet/DeclarationBlock.php
110+
111+
-
112+
message: '#^Parameter \#1 \$comments of method Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:setComments\(\) expects list\<Sabberworm\\CSS\\Comment\\Comment\>, array\<int, Sabberworm\\CSS\\Comment\\Comment\> given\.$#'
113+
identifier: argument.type
114+
count: 1
115+
path: ../src/RuleSet/DeclarationBlock.php
116+
33117
-
34118
message: '#^Parameters should have "string" types as the only types passed to this method$#'
35119
identifier: typePerfect.narrowPublicClassMethodParamType
36120
count: 1
37121
path: ../src/RuleSet/DeclarationBlock.php
38122

123+
-
124+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
125+
identifier: argument.type
126+
count: 1
127+
path: ../src/Value/CSSFunction.php
128+
39129
-
40130
message: '#^Parameter \#2 \$arguments of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects array\<Sabberworm\\CSS\\Value\\Value\|string\>\|Sabberworm\\CSS\\Value\\RuleValueList, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
41131
identifier: argument.type
@@ -54,6 +144,30 @@ parameters:
54144
count: 3
55145
path: ../src/Value/Color.php
56146

147+
-
148+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:__construct\(\) expects non\-empty\-string, string given\.$#'
149+
identifier: argument.type
150+
count: 1
151+
path: ../src/Value/Color.php
152+
153+
-
154+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:setName\(\) expects non\-empty\-string, string given\.$#'
155+
identifier: argument.type
156+
count: 1
157+
path: ../src/Value/Color.php
158+
159+
-
160+
message: '#^Method Sabberworm\\CSS\\Value\\Size\:\:render\(\) should return non\-empty\-string but returns string\.$#'
161+
identifier: return.type
162+
count: 1
163+
path: ../src/Value/Size.php
164+
165+
-
166+
message: '#^Only booleans are allowed in a ternary operator condition, int\|false given\.$#'
167+
identifier: ternary.condNotBoolean
168+
count: 1
169+
path: ../src/Value/Size.php
170+
57171
-
58172
message: '#^Parameters should have "float" types as the only types passed to this method$#'
59173
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -66,6 +180,24 @@ parameters:
66180
count: 1
67181
path: ../src/Value/Size.php
68182

183+
-
184+
message: '#^Method Sabberworm\\CSS\\Value\\Value\:\:parseIdentifierOrFunction\(\) should return Sabberworm\\CSS\\Value\\CSSFunction\|string but returns Sabberworm\\CSS\\Value\\CSSFunction\|Sabberworm\\CSS\\Value\\URL\|string\.$#'
185+
identifier: return.type
186+
count: 1
187+
path: ../src/Value/Value.php
188+
189+
-
190+
message: '#^Only booleans are allowed in &&, int\|false given on the right side\.$#'
191+
identifier: booleanAnd.rightNotBoolean
192+
count: 1
193+
path: ../src/Value/Value.php
194+
195+
-
196+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
197+
identifier: argument.type
198+
count: 1
199+
path: ../src/Value/Value.php
200+
69201
-
70202
message: '#^Parameter \#2 \$arguments of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects array\<Sabberworm\\CSS\\Value\\Value\|string\>\|Sabberworm\\CSS\\Value\\RuleValueList, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
71203
identifier: argument.type
@@ -78,18 +210,60 @@ parameters:
78210
count: 1
79211
path: ../src/Value/Value.php
80212

213+
-
214+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
215+
identifier: argument.type
216+
count: 1
217+
path: ../tests/Functional/RuleSet/RuleSetTest.php
218+
81219
-
82220
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
83221
identifier: staticMethod.impossibleType
84222
count: 1
85223
path: ../tests/ParserTest.php
86224

225+
-
226+
message: '#^Cannot call method getListComponents\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
227+
identifier: method.nonObject
228+
count: 2
229+
path: ../tests/ParserTest.php
230+
231+
-
232+
message: '#^Cannot call method getListSeparator\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
233+
identifier: method.nonObject
234+
count: 2
235+
path: ../tests/ParserTest.php
236+
237+
-
238+
message: '#^Cannot call method render\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
239+
identifier: method.nonObject
240+
count: 1
241+
path: ../tests/ParserTest.php
242+
243+
-
244+
message: '#^Only booleans are allowed in an if condition, resource\|false given\.$#'
245+
identifier: if.condNotBoolean
246+
count: 1
247+
path: ../tests/ParserTest.php
248+
249+
-
250+
message: '#^Parameter \#1 \$text of class Sabberworm\\CSS\\Parser constructor expects string, string\|false given\.$#'
251+
identifier: argument.type
252+
count: 2
253+
path: ../tests/ParserTest.php
254+
87255
-
88256
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Size given\.$#'
89257
identifier: argument.type
90258
count: 3
91259
path: ../tests/RuleSet/DeclarationBlockTest.php
92260

261+
-
262+
message: '#^Parameter \#1 \$text of class Sabberworm\\CSS\\Parser constructor expects string, string\|false given\.$#'
263+
identifier: argument.type
264+
count: 10
265+
path: ../tests/RuleSet/LenientParsingTest.php
266+
93267
-
94268
message: '#^Parameter \#1 \$type of class Sabberworm\\CSS\\CSSList\\AtRuleBlockList constructor expects non\-empty\-string, '''' given\.$#'
95269
identifier: argument.type
@@ -113,3 +287,45 @@ parameters:
113287
identifier: argument.type
114288
count: 2
115289
path: ../tests/Unit/CSSList/CSSListTest.php
290+
291+
-
292+
message: '#^Method Sabberworm\\CSS\\Tests\\Unit\\Comment\\CommentContainerTest\:\:provideAlternativeNonemptyCommentArray\(\) should return array\<non\-empty\-string, array\{non\-empty\-list\<Sabberworm\\CSS\\Comment\\Comment\>\}\> but returns array\<non\-empty\-string, array\{list\<Sabberworm\\CSS\\Comment\\Comment\>\}\>\.$#'
293+
identifier: return.type
294+
count: 1
295+
path: ../tests/Unit/Comment/CommentContainerTest.php
296+
297+
-
298+
message: '#^Parameter \#1 \$numberOfSpaces of method Sabberworm\\CSS\\OutputFormat\:\:indentWithSpaces\(\) expects int\<1, max\>, int given\.$#'
299+
identifier: argument.type
300+
count: 1
301+
path: ../tests/Unit/OutputFormatTest.php
302+
303+
-
304+
message: '#^Parameter \#1 \$numberOfTabs of method Sabberworm\\CSS\\OutputFormat\:\:indentWithTabs\(\) expects int\<1, max\>, int given\.$#'
305+
identifier: argument.type
306+
count: 1
307+
path: ../tests/Unit/OutputFormatTest.php
308+
309+
-
310+
message: '#^Parameter \#1 \$lineNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<1, max\>\|null, int given\.$#'
311+
identifier: argument.type
312+
count: 2
313+
path: ../tests/Unit/Position/PositionTest.php
314+
315+
-
316+
message: '#^Parameter \#2 \$columnNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<0, max\>\|null, int given\.$#'
317+
identifier: argument.type
318+
count: 3
319+
path: ../tests/Unit/Position/PositionTest.php
320+
321+
-
322+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
323+
identifier: argument.type
324+
count: 19
325+
path: ../tests/Unit/RuleSet/DeclarationBlockTest.php
326+
327+
-
328+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
329+
identifier: argument.type
330+
count: 19
331+
path: ../tests/Unit/RuleSet/RuleSetTest.php

config/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ parameters:
88

99
phpVersion: 70200
1010

11-
level: 6
11+
level: 7
1212

1313
paths:
1414
- %currentWorkingDirectory%/bin/

0 commit comments

Comments
 (0)