Skip to content

Commit a5e5db1

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

2 files changed

Lines changed: 259 additions & 1 deletion

File tree

config/phpstan-baseline.neon

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,59 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\CSSList\\CSSListItem\|false given\.$#'
5+
identifier: if.condNotBoolean
6+
count: 1
7+
path: ../src/CSSList/CSSList.php
8+
9+
-
10+
message: '#^Parameter \#1 \$animationName of method Sabberworm\\CSS\\CSSList\\KeyFrame\:\:setAnimationName\(\) expects non\-empty\-string, string given\.$#'
11+
identifier: argument.type
12+
count: 1
13+
path: ../src/CSSList/CSSList.php
14+
15+
-
16+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\Selector constructor expects non\-empty\-list\<Sabberworm\\CSS\\Property\\Selector\\Component\>\|non\-empty\-string, string given\.$#'
17+
identifier: argument.type
18+
count: 1
19+
path: ../src/CSSList/CSSList.php
20+
321
-
422
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\.$#'
523
identifier: argument.type
624
count: 1
725
path: ../src/CSSList/CSSList.php
826

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+
33+
-
34+
message: '#^Parameter \#2 \$selectors2 of static method Sabberworm\\CSS\\CSSList\\CSSList\:\:selectorsMatch\(\) expects list\<Sabberworm\\CSS\\Property\\Selector\>, array\<Sabberworm\\CSS\\Property\\Selector\|string\> given\.$#'
35+
identifier: argument.type
36+
count: 1
37+
path: ../src/CSSList/CSSList.php
38+
939
-
1040
message: '#^Parameters should have "Sabberworm\\CSS\\CSSList\\CSSListItem\|array" types as the only types passed to this method$#'
1141
identifier: typePerfect.narrowPublicClassMethodParamType
1242
count: 1
1343
path: ../src/CSSList/CSSList.php
1444

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+
1557
-
1658
message: '#^Negated boolean expression is always true\.$#'
1759
identifier: booleanNot.alwaysTrue
@@ -24,12 +66,78 @@ parameters:
2466
count: 1
2567
path: ../src/Parsing/ParserState.php
2668

69+
-
70+
message: '#^Property Sabberworm\\CSS\\Parsing\\ParserState\:\:\$currentPosition \(int\<0, max\>\) does not accept int\.$#'
71+
identifier: assign.propertyType
72+
count: 2
73+
path: ../src/Parsing/ParserState.php
74+
75+
-
76+
message: '#^Method Sabberworm\\CSS\\Property\\Declaration\:\:getArrayRepresentation\(\) should return array\<string, array\<mixed\>\|bool\|float\|int\|string\|null\> but returns array\<string, bool\|Sabberworm\\CSS\\Value\\RuleValueList\|string\|null\>\.$#'
77+
identifier: return.type
78+
count: 1
79+
path: ../src/Property/Declaration.php
80+
81+
-
82+
message: '#^Parameter \#1 \$separator of class Sabberworm\\CSS\\Value\\RuleValueList constructor expects non\-empty\-string, string given\.$#'
83+
identifier: argument.type
84+
count: 1
85+
path: ../src/Property/Declaration.php
86+
87+
-
88+
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Property\\Declaration\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
89+
identifier: argument.type
90+
count: 1
91+
path: ../src/Property/Declaration.php
92+
93+
-
94+
message: '#^Method Sabberworm\\CSS\\Property\\Selector\:\:getSelector\(\) should return non\-empty\-string but returns string\.$#'
95+
identifier: return.type
96+
count: 1
97+
path: ../src/Property/Selector.php
98+
99+
-
100+
message: '#^Method Sabberworm\\CSS\\Property\\Selector\:\:parseComponents\(\) should return non\-empty\-list\<Sabberworm\\CSS\\Property\\Selector\\Component\> but returns list\<Sabberworm\\CSS\\Property\\Selector\\Combinator\|Sabberworm\\CSS\\Property\\Selector\\CompoundSelector\>\.$#'
101+
identifier: return.type
102+
count: 1
103+
path: ../src/Property/Selector.php
104+
105+
-
106+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\KeyframeSelector constructor expects non\-empty\-list\<Sabberworm\\CSS\\Property\\Selector\\Component\>\|non\-empty\-string, string given\.$#'
107+
identifier: argument.type
108+
count: 1
109+
path: ../src/RuleSet/DeclarationBlock.php
110+
111+
-
112+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\Selector constructor expects non\-empty\-list\<Sabberworm\\CSS\\Property\\Selector\\Component\>\|non\-empty\-string, string given\.$#'
113+
identifier: argument.type
114+
count: 1
115+
path: ../src/RuleSet/DeclarationBlock.php
116+
27117
-
28118
message: '#^Parameters should have "string" types as the only types passed to this method$#'
29119
identifier: typePerfect.narrowPublicClassMethodParamType
30120
count: 1
31121
path: ../src/RuleSet/DeclarationBlock.php
32122

123+
-
124+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept array\<int\<0, max\>, Sabberworm\\CSS\\Property\\Selector\>\.$#'
125+
identifier: assign.propertyType
126+
count: 1
127+
path: ../src/RuleSet/DeclarationBlock.php
128+
129+
-
130+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept list\<Sabberworm\\CSS\\Property\\Selector\|string\>\.$#'
131+
identifier: assign.propertyType
132+
count: 1
133+
path: ../src/RuleSet/DeclarationBlock.php
134+
135+
-
136+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
137+
identifier: argument.type
138+
count: 1
139+
path: ../src/Value/CSSFunction.php
140+
33141
-
34142
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\.$#'
35143
identifier: argument.type
@@ -48,6 +156,24 @@ parameters:
48156
count: 3
49157
path: ../src/Value/Color.php
50158

159+
-
160+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:__construct\(\) expects non\-empty\-string, string given\.$#'
161+
identifier: argument.type
162+
count: 1
163+
path: ../src/Value/Color.php
164+
165+
-
166+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:setName\(\) expects non\-empty\-string, string given\.$#'
167+
identifier: argument.type
168+
count: 1
169+
path: ../src/Value/Color.php
170+
171+
-
172+
message: '#^Method Sabberworm\\CSS\\Value\\Size\:\:render\(\) should return non\-empty\-string but returns string\.$#'
173+
identifier: return.type
174+
count: 1
175+
path: ../src/Value/Size.php
176+
51177
-
52178
message: '#^Parameters should have "float" types as the only types passed to this method$#'
53179
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -60,6 +186,18 @@ parameters:
60186
count: 1
61187
path: ../src/Value/Size.php
62188

189+
-
190+
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\.$#'
191+
identifier: return.type
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+
63201
-
64202
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\.$#'
65203
identifier: argument.type
@@ -72,12 +210,36 @@ parameters:
72210
count: 1
73211
path: ../src/Value/Value.php
74212

213+
-
214+
message: '#^Parameter \#1 \$propertyName of class Sabberworm\\CSS\\Property\\Declaration constructor expects non\-empty\-string, string given\.$#'
215+
identifier: argument.type
216+
count: 1
217+
path: ../tests/Functional/RuleSet/RuleSetTest.php
218+
75219
-
76220
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
77221
identifier: staticMethod.impossibleType
78222
count: 1
79223
path: ../tests/ParserTest.php
80224

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+
81243
-
82244
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Property\\Declaration\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Size given\.$#'
83245
identifier: argument.type
@@ -107,3 +269,99 @@ parameters:
107269
identifier: argument.type
108270
count: 2
109271
path: ../tests/Unit/CSSList/CSSListTest.php
272+
273+
-
274+
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\>\}\>\.$#'
275+
identifier: return.type
276+
count: 1
277+
path: ../tests/Unit/Comment/CommentContainerTest.php
278+
279+
-
280+
message: '#^Parameter \#1 \$numberOfSpaces of method Sabberworm\\CSS\\OutputFormat\:\:indentWithSpaces\(\) expects int\<1, max\>, int given\.$#'
281+
identifier: argument.type
282+
count: 1
283+
path: ../tests/Unit/OutputFormatTest.php
284+
285+
-
286+
message: '#^Parameter \#1 \$numberOfTabs of method Sabberworm\\CSS\\OutputFormat\:\:indentWithTabs\(\) expects int\<1, max\>, int given\.$#'
287+
identifier: argument.type
288+
count: 1
289+
path: ../tests/Unit/OutputFormatTest.php
290+
291+
-
292+
message: '#^Parameter \#1 \$lineNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<1, max\>\|null, int given\.$#'
293+
identifier: argument.type
294+
count: 2
295+
path: ../tests/Unit/Position/PositionTest.php
296+
297+
-
298+
message: '#^Parameter \#2 \$columnNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<0, max\>\|null, int given\.$#'
299+
identifier: argument.type
300+
count: 3
301+
path: ../tests/Unit/Position/PositionTest.php
302+
303+
-
304+
message: '#^Cannot access offset 0 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
305+
identifier: offsetAccess.nonOffsetAccessible
306+
count: 1
307+
path: ../tests/Unit/Property/KeyframeSelectorTest.php
308+
309+
-
310+
message: '#^Parameter \#1 \$value of class Sabberworm\\CSS\\Property\\Selector\\Combinator constructor expects '' ''\|''\+''\|''\>''\|''~'', non\-empty\-string given\.$#'
311+
identifier: argument.type
312+
count: 1
313+
path: ../tests/Unit/Property/Selector/CombinatorTest.php
314+
315+
-
316+
message: '#^Cannot access offset 0 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
317+
identifier: offsetAccess.nonOffsetAccessible
318+
count: 1
319+
path: ../tests/Unit/Property/SelectorTest.php
320+
321+
-
322+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\Selector constructor expects non\-empty\-list\<Sabberworm\\CSS\\Property\\Selector\\Component\>\|non\-empty\-string, string given\.$#'
323+
identifier: argument.type
324+
count: 1
325+
path: ../tests/Unit/Property/SelectorTest.php
326+
327+
-
328+
message: '#^Parameter \#1 \$selector of method Sabberworm\\CSS\\Property\\Selector\:\:setSelector\(\) expects non\-empty\-string, string given\.$#'
329+
identifier: argument.type
330+
count: 1
331+
path: ../tests/Unit/Property/SelectorTest.php
332+
333+
-
334+
message: '#^Parameter \#1 \$propertyName of class Sabberworm\\CSS\\Property\\Declaration constructor expects non\-empty\-string, string given\.$#'
335+
identifier: argument.type
336+
count: 19
337+
path: ../tests/Unit/RuleSet/DeclarationBlockTest.php
338+
339+
-
340+
message: '#^Parameter \#1 \$propertyName of class Sabberworm\\CSS\\Property\\Declaration constructor expects non\-empty\-string, string given\.$#'
341+
identifier: argument.type
342+
count: 19
343+
path: ../tests/Unit/RuleSet/RuleSetTest.php
344+
345+
-
346+
message: '#^Cannot access offset 0 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
347+
identifier: offsetAccess.nonOffsetAccessible
348+
count: 3
349+
path: ../tests/Unit/Value/ValueListTest.php
350+
351+
-
352+
message: '#^Cannot access offset 1 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
353+
identifier: offsetAccess.nonOffsetAccessible
354+
count: 1
355+
path: ../tests/Unit/Value/ValueListTest.php
356+
357+
-
358+
message: '#^Cannot access offset 2 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
359+
identifier: offsetAccess.nonOffsetAccessible
360+
count: 1
361+
path: ../tests/Unit/Value/ValueListTest.php
362+
363+
-
364+
message: '#^Cannot call method getArrayRepresentation\(\) on Sabberworm\\CSS\\Value\\Value\|string\.$#'
365+
identifier: method.nonObject
366+
count: 1
367+
path: ../tests/Unit/Value/ValueTest.php

config/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ includes:
44
parameters:
55
phpVersion: 70200
66

7-
level: 6
7+
level: 7
88

99
paths:
1010
- %currentWorkingDirectory%/bin/

0 commit comments

Comments
 (0)