Skip to content

Commit 350b9d5

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

File tree

2 files changed

+307
-1
lines changed

2 files changed

+307
-1
lines changed

config/phpstan-baseline.neon

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
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\-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
@@ -18,24 +48,132 @@ parameters:
1848
count: 1
1949
path: ../src/CSSList/Document.php
2050

51+
-
52+
message: '#^Method Sabberworm\\CSS\\Comment\\Comment\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
53+
identifier: return.type
54+
count: 1
55+
path: ../src/Comment/Comment.php
56+
57+
-
58+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:parseIdentifier\(\) should return non\-empty\-string but returns string\.$#'
59+
identifier: return.type
60+
count: 1
61+
path: ../src/Parsing/ParserState.php
62+
63+
-
64+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:strlen\(\) should return int\<0, max\> but returns int\<0, max\>\|false\.$#'
65+
identifier: return.type
66+
count: 1
67+
path: ../src/Parsing/ParserState.php
68+
2169
-
2270
message: '#^Negated boolean expression is always true\.$#'
2371
identifier: booleanNot.alwaysTrue
2472
count: 1
2573
path: ../src/Parsing/ParserState.php
2674

75+
-
76+
message: '#^Property Sabberworm\\CSS\\Parsing\\ParserState\:\:\$currentPosition \(int\<0, max\>\) does not accept int\.$#'
77+
identifier: assign.propertyType
78+
count: 2
79+
path: ../src/Parsing/ParserState.php
80+
81+
-
82+
message: '#^Method Sabberworm\\CSS\\Property\\Charset\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
83+
identifier: return.type
84+
count: 1
85+
path: ../src/Property/Charset.php
86+
87+
-
88+
message: '#^Method Sabberworm\\CSS\\Property\\Selector\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
89+
identifier: return.type
90+
count: 1
91+
path: ../src/Property/Selector.php
92+
93+
-
94+
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\>\.$#'
95+
identifier: return.type
96+
count: 1
97+
path: ../src/Property/Selector.php
98+
99+
-
100+
message: '#^Property Sabberworm\\CSS\\Property\\Selector\:\:\$selector \(non\-empty\-string\) does not accept string\.$#'
101+
identifier: assign.propertyType
102+
count: 1
103+
path: ../src/Property/Selector.php
104+
105+
-
106+
message: '#^Method Sabberworm\\CSS\\Property\\Selector\\Combinator\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
107+
identifier: return.type
108+
count: 1
109+
path: ../src/Property/Selector/Combinator.php
110+
111+
-
112+
message: '#^Method Sabberworm\\CSS\\Property\\Selector\\CompoundSelector\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
113+
identifier: return.type
114+
count: 1
115+
path: ../src/Property/Selector/CompoundSelector.php
116+
117+
-
118+
message: '#^Parameter \#1 \$separator of class Sabberworm\\CSS\\Value\\RuleValueList constructor expects non\-empty\-string, string given\.$#'
119+
identifier: argument.type
120+
count: 1
121+
path: ../src/Rule/Rule.php
122+
123+
-
124+
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
125+
identifier: argument.type
126+
count: 1
127+
path: ../src/Rule/Rule.php
128+
129+
-
130+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\KeyframeSelector constructor expects non\-empty\-string, string given\.$#'
131+
identifier: argument.type
132+
count: 1
133+
path: ../src/RuleSet/DeclarationBlock.php
134+
135+
-
136+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\Selector constructor expects non\-empty\-string, string given\.$#'
137+
identifier: argument.type
138+
count: 1
139+
path: ../src/RuleSet/DeclarationBlock.php
140+
27141
-
28142
message: '#^Parameters should have "string" types as the only types passed to this method$#'
29143
identifier: typePerfect.narrowPublicClassMethodParamType
30144
count: 1
31145
path: ../src/RuleSet/DeclarationBlock.php
32146

147+
-
148+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept array\<int\<0, max\>, Sabberworm\\CSS\\Property\\Selector\>\.$#'
149+
identifier: assign.propertyType
150+
count: 1
151+
path: ../src/RuleSet/DeclarationBlock.php
152+
153+
-
154+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept list\<Sabberworm\\CSS\\Property\\Selector\|string\>\.$#'
155+
identifier: assign.propertyType
156+
count: 1
157+
path: ../src/RuleSet/DeclarationBlock.php
158+
159+
-
160+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
161+
identifier: argument.type
162+
count: 1
163+
path: ../src/Value/CSSFunction.php
164+
33165
-
34166
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\.$#'
35167
identifier: argument.type
36168
count: 1
37169
path: ../src/Value/CSSFunction.php
38170

171+
-
172+
message: '#^Method Sabberworm\\CSS\\Value\\CSSString\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
173+
identifier: return.type
174+
count: 1
175+
path: ../src/Value/CSSString.php
176+
39177
-
40178
message: '#^Parameter \#2 \$offset of method Sabberworm\\CSS\\Parsing\\ParserState\:\:peek\(\) expects int\<0, max\>, \-1 given\.$#'
41179
identifier: argument.type
@@ -48,6 +186,30 @@ parameters:
48186
count: 3
49187
path: ../src/Value/Color.php
50188

189+
-
190+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:__construct\(\) expects non\-empty\-string, string given\.$#'
191+
identifier: argument.type
192+
count: 1
193+
path: ../src/Value/Color.php
194+
195+
-
196+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:setName\(\) expects non\-empty\-string, string given\.$#'
197+
identifier: argument.type
198+
count: 1
199+
path: ../src/Value/Color.php
200+
201+
-
202+
message: '#^Method Sabberworm\\CSS\\Value\\Size\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
203+
identifier: return.type
204+
count: 1
205+
path: ../src/Value/Size.php
206+
207+
-
208+
message: '#^Method Sabberworm\\CSS\\Value\\Size\:\:render\(\) should return non\-empty\-string but returns string\.$#'
209+
identifier: return.type
210+
count: 1
211+
path: ../src/Value/Size.php
212+
51213
-
52214
message: '#^Parameters should have "float" types as the only types passed to this method$#'
53215
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -60,6 +222,30 @@ parameters:
60222
count: 1
61223
path: ../src/Value/Size.php
62224

225+
-
226+
message: '#^Method Sabberworm\\CSS\\Value\\URL\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
227+
identifier: return.type
228+
count: 1
229+
path: ../src/Value/URL.php
230+
231+
-
232+
message: '#^Method Sabberworm\\CSS\\Value\\Value\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
233+
identifier: return.type
234+
count: 1
235+
path: ../src/Value/Value.php
236+
237+
-
238+
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\.$#'
239+
identifier: return.type
240+
count: 1
241+
path: ../src/Value/Value.php
242+
243+
-
244+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
245+
identifier: argument.type
246+
count: 1
247+
path: ../src/Value/Value.php
248+
63249
-
64250
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\.$#'
65251
identifier: argument.type
@@ -72,12 +258,42 @@ parameters:
72258
count: 1
73259
path: ../src/Value/Value.php
74260

261+
-
262+
message: '#^Method Sabberworm\\CSS\\Value\\ValueList\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
263+
identifier: return.type
264+
count: 1
265+
path: ../src/Value/ValueList.php
266+
267+
-
268+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
269+
identifier: argument.type
270+
count: 1
271+
path: ../tests/Functional/RuleSet/RuleSetTest.php
272+
75273
-
76274
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
77275
identifier: staticMethod.impossibleType
78276
count: 1
79277
path: ../tests/ParserTest.php
80278

279+
-
280+
message: '#^Cannot call method getListComponents\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
281+
identifier: method.nonObject
282+
count: 2
283+
path: ../tests/ParserTest.php
284+
285+
-
286+
message: '#^Cannot call method getListSeparator\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
287+
identifier: method.nonObject
288+
count: 2
289+
path: ../tests/ParserTest.php
290+
291+
-
292+
message: '#^Cannot call method render\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
293+
identifier: method.nonObject
294+
count: 1
295+
path: ../tests/ParserTest.php
296+
81297
-
82298
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Size given\.$#'
83299
identifier: argument.type
@@ -107,3 +323,93 @@ parameters:
107323
identifier: argument.type
108324
count: 2
109325
path: ../tests/Unit/CSSList/CSSListTest.php
326+
327+
-
328+
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\>\}\>\.$#'
329+
identifier: return.type
330+
count: 1
331+
path: ../tests/Unit/Comment/CommentContainerTest.php
332+
333+
-
334+
message: '#^Method Sabberworm\\CSS\\Tests\\Unit\\Fixtures\\ConcreteShortClassNameProvider\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
335+
identifier: return.type
336+
count: 1
337+
path: ../tests/Unit/Fixtures/ConcreteShortClassNameProvider.php
338+
339+
-
340+
message: '#^Parameter \#1 \$numberOfSpaces of method Sabberworm\\CSS\\OutputFormat\:\:indentWithSpaces\(\) expects int\<1, max\>, int given\.$#'
341+
identifier: argument.type
342+
count: 1
343+
path: ../tests/Unit/OutputFormatTest.php
344+
345+
-
346+
message: '#^Parameter \#1 \$numberOfTabs of method Sabberworm\\CSS\\OutputFormat\:\:indentWithTabs\(\) expects int\<1, max\>, int given\.$#'
347+
identifier: argument.type
348+
count: 1
349+
path: ../tests/Unit/OutputFormatTest.php
350+
351+
-
352+
message: '#^Parameter \#1 \$lineNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<1, max\>\|null, int given\.$#'
353+
identifier: argument.type
354+
count: 2
355+
path: ../tests/Unit/Position/PositionTest.php
356+
357+
-
358+
message: '#^Parameter \#2 \$columnNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<0, max\>\|null, int given\.$#'
359+
identifier: argument.type
360+
count: 3
361+
path: ../tests/Unit/Position/PositionTest.php
362+
363+
-
364+
message: '#^Parameter \#1 \$value of class Sabberworm\\CSS\\Property\\Selector\\Combinator constructor expects '' ''\|''\+''\|''\>''\|''~'', non\-empty\-string given\.$#'
365+
identifier: argument.type
366+
count: 1
367+
path: ../tests/Unit/Property/Selector/CombinatorTest.php
368+
369+
-
370+
message: '#^Parameter \#1 \$selector of class Sabberworm\\CSS\\Property\\Selector constructor expects non\-empty\-string, string given\.$#'
371+
identifier: argument.type
372+
count: 1
373+
path: ../tests/Unit/Property/SelectorTest.php
374+
375+
-
376+
message: '#^Parameter \#1 \$selector of method Sabberworm\\CSS\\Property\\Selector\:\:setSelector\(\) expects non\-empty\-string, string given\.$#'
377+
identifier: argument.type
378+
count: 1
379+
path: ../tests/Unit/Property/SelectorTest.php
380+
381+
-
382+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
383+
identifier: argument.type
384+
count: 19
385+
path: ../tests/Unit/RuleSet/DeclarationBlockTest.php
386+
387+
-
388+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
389+
identifier: argument.type
390+
count: 19
391+
path: ../tests/Unit/RuleSet/RuleSetTest.php
392+
393+
-
394+
message: '#^Cannot access offset 0 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
395+
identifier: offsetAccess.nonOffsetAccessible
396+
count: 3
397+
path: ../tests/Unit/Value/ValueListTest.php
398+
399+
-
400+
message: '#^Cannot access offset 1 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
401+
identifier: offsetAccess.nonOffsetAccessible
402+
count: 1
403+
path: ../tests/Unit/Value/ValueListTest.php
404+
405+
-
406+
message: '#^Cannot access offset 2 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
407+
identifier: offsetAccess.nonOffsetAccessible
408+
count: 1
409+
path: ../tests/Unit/Value/ValueListTest.php
410+
411+
-
412+
message: '#^Cannot call method getArrayRepresentation\(\) on Sabberworm\\CSS\\Value\\Value\|string\.$#'
413+
identifier: method.nonObject
414+
count: 1
415+
path: ../tests/Unit/Value/ValueTest.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)