Skip to content

Commit 090efb4

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

2 files changed

Lines changed: 241 additions & 1 deletion

File tree

config/phpstan-baseline.neon

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
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+
315
-
416
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\.$#'
517
identifier: argument.type
618
count: 1
719
path: ../src/CSSList/CSSList.php
820

21+
-
22+
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\.$#'
23+
identifier: argument.type
24+
count: 1
25+
path: ../src/CSSList/CSSList.php
26+
27+
-
28+
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\.$#'
29+
identifier: argument.type
30+
count: 1
31+
path: ../src/CSSList/CSSList.php
32+
933
-
1034
message: '#^Parameters should have "Sabberworm\\CSS\\CSSList\\CSSListItem\|array" types as the only types passed to this method$#'
1135
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -18,24 +42,90 @@ parameters:
1842
count: 1
1943
path: ../src/CSSList/Document.php
2044

45+
-
46+
message: '#^Method Sabberworm\\CSS\\Comment\\Comment\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
47+
identifier: return.type
48+
count: 1
49+
path: ../src/Comment/Comment.php
50+
51+
-
52+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:parseIdentifier\(\) should return non\-empty\-string but returns string\.$#'
53+
identifier: return.type
54+
count: 1
55+
path: ../src/Parsing/ParserState.php
56+
57+
-
58+
message: '#^Method Sabberworm\\CSS\\Parsing\\ParserState\:\:strlen\(\) should return int\<0, max\> but returns int\<0, max\>\|false\.$#'
59+
identifier: return.type
60+
count: 1
61+
path: ../src/Parsing/ParserState.php
62+
2163
-
2264
message: '#^Negated boolean expression is always true\.$#'
2365
identifier: booleanNot.alwaysTrue
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\\Charset\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
77+
identifier: return.type
78+
count: 1
79+
path: ../src/Property/Charset.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/Rule/Rule.php
86+
87+
-
88+
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Value\|string given\.$#'
89+
identifier: argument.type
90+
count: 1
91+
path: ../src/Rule/Rule.php
92+
2793
-
2894
message: '#^Parameters should have "string" types as the only types passed to this method$#'
2995
identifier: typePerfect.narrowPublicClassMethodParamType
3096
count: 1
3197
path: ../src/RuleSet/DeclarationBlock.php
3298

99+
-
100+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept array\<int\<0, max\>, Sabberworm\\CSS\\Property\\Selector\>\.$#'
101+
identifier: assign.propertyType
102+
count: 1
103+
path: ../src/RuleSet/DeclarationBlock.php
104+
105+
-
106+
message: '#^Property Sabberworm\\CSS\\RuleSet\\DeclarationBlock\:\:\$selectors \(list\<Sabberworm\\CSS\\Property\\Selector\>\) does not accept list\<Sabberworm\\CSS\\Property\\Selector\|string\>\.$#'
107+
identifier: assign.propertyType
108+
count: 1
109+
path: ../src/RuleSet/DeclarationBlock.php
110+
111+
-
112+
message: '#^Parameter \#1 \$name of class Sabberworm\\CSS\\Value\\CSSFunction constructor expects non\-empty\-string, string given\.$#'
113+
identifier: argument.type
114+
count: 1
115+
path: ../src/Value/CSSFunction.php
116+
33117
-
34118
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\.$#'
35119
identifier: argument.type
36120
count: 1
37121
path: ../src/Value/CSSFunction.php
38122

123+
-
124+
message: '#^Method Sabberworm\\CSS\\Value\\CSSString\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
125+
identifier: return.type
126+
count: 1
127+
path: ../src/Value/CSSString.php
128+
39129
-
40130
message: '#^Parameter \#2 \$offset of method Sabberworm\\CSS\\Parsing\\ParserState\:\:peek\(\) expects int\<0, max\>, \-1 given\.$#'
41131
identifier: argument.type
@@ -48,6 +138,30 @@ parameters:
48138
count: 3
49139
path: ../src/Value/Color.php
50140

141+
-
142+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:__construct\(\) expects non\-empty\-string, string given\.$#'
143+
identifier: argument.type
144+
count: 1
145+
path: ../src/Value/Color.php
146+
147+
-
148+
message: '#^Parameter \#1 \$name of method Sabberworm\\CSS\\Value\\CSSFunction\:\:setName\(\) expects non\-empty\-string, string given\.$#'
149+
identifier: argument.type
150+
count: 1
151+
path: ../src/Value/Color.php
152+
153+
-
154+
message: '#^Method Sabberworm\\CSS\\Value\\Size\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
155+
identifier: return.type
156+
count: 1
157+
path: ../src/Value/Size.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+
51165
-
52166
message: '#^Parameters should have "float" types as the only types passed to this method$#'
53167
identifier: typePerfect.narrowPublicClassMethodParamType
@@ -60,6 +174,30 @@ parameters:
60174
count: 1
61175
path: ../src/Value/Size.php
62176

177+
-
178+
message: '#^Method Sabberworm\\CSS\\Value\\URL\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
179+
identifier: return.type
180+
count: 1
181+
path: ../src/Value/URL.php
182+
183+
-
184+
message: '#^Method Sabberworm\\CSS\\Value\\Value\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
185+
identifier: return.type
186+
count: 1
187+
path: ../src/Value/Value.php
188+
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,42 @@ parameters:
72210
count: 1
73211
path: ../src/Value/Value.php
74212

213+
-
214+
message: '#^Method Sabberworm\\CSS\\Value\\ValueList\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
215+
identifier: return.type
216+
count: 1
217+
path: ../src/Value/ValueList.php
218+
219+
-
220+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
221+
identifier: argument.type
222+
count: 1
223+
path: ../tests/Functional/RuleSet/RuleSetTest.php
224+
75225
-
76226
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with ''red'' and Sabberworm\\CSS\\Value\\Value will always evaluate to false\.$#'
77227
identifier: staticMethod.impossibleType
78228
count: 1
79229
path: ../tests/ParserTest.php
80230

231+
-
232+
message: '#^Cannot call method getListComponents\(\) 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 getListSeparator\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
239+
identifier: method.nonObject
240+
count: 2
241+
path: ../tests/ParserTest.php
242+
243+
-
244+
message: '#^Cannot call method render\(\) on Sabberworm\\CSS\\Value\\RuleValueList\|string\.$#'
245+
identifier: method.nonObject
246+
count: 1
247+
path: ../tests/ParserTest.php
248+
81249
-
82250
message: '#^Parameter \#1 \$value of method Sabberworm\\CSS\\Rule\\Rule\:\:setValue\(\) expects Sabberworm\\CSS\\Value\\RuleValueList\|string\|null, Sabberworm\\CSS\\Value\\Size given\.$#'
83251
identifier: argument.type
@@ -107,3 +275,75 @@ parameters:
107275
identifier: argument.type
108276
count: 2
109277
path: ../tests/Unit/CSSList/CSSListTest.php
278+
279+
-
280+
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\>\}\>\.$#'
281+
identifier: return.type
282+
count: 1
283+
path: ../tests/Unit/Comment/CommentContainerTest.php
284+
285+
-
286+
message: '#^Method Sabberworm\\CSS\\Tests\\Unit\\Fixtures\\ConcreteShortClassNameProvider\:\:getShortClassName\(\) should return non\-empty\-string but returns string\.$#'
287+
identifier: return.type
288+
count: 1
289+
path: ../tests/Unit/Fixtures/ConcreteShortClassNameProvider.php
290+
291+
-
292+
message: '#^Parameter \#1 \$numberOfSpaces of method Sabberworm\\CSS\\OutputFormat\:\:indentWithSpaces\(\) expects int\<1, max\>, int given\.$#'
293+
identifier: argument.type
294+
count: 1
295+
path: ../tests/Unit/OutputFormatTest.php
296+
297+
-
298+
message: '#^Parameter \#1 \$numberOfTabs of method Sabberworm\\CSS\\OutputFormat\:\:indentWithTabs\(\) 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 \$lineNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<1, max\>\|null, int given\.$#'
305+
identifier: argument.type
306+
count: 2
307+
path: ../tests/Unit/Position/PositionTest.php
308+
309+
-
310+
message: '#^Parameter \#2 \$columnNumber of method Sabberworm\\CSS\\Tests\\Unit\\Position\\Fixtures\\ConcretePosition\:\:setPosition\(\) expects int\<0, max\>\|null, int given\.$#'
311+
identifier: argument.type
312+
count: 3
313+
path: ../tests/Unit/Position/PositionTest.php
314+
315+
-
316+
message: '#^Parameter \#1 \$rule of class Sabberworm\\CSS\\Rule\\Rule constructor expects non\-empty\-string, string given\.$#'
317+
identifier: argument.type
318+
count: 19
319+
path: ../tests/Unit/RuleSet/DeclarationBlockTest.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/RuleSetTest.php
326+
327+
-
328+
message: '#^Cannot access offset 0 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
329+
identifier: offsetAccess.nonOffsetAccessible
330+
count: 3
331+
path: ../tests/Unit/Value/ValueListTest.php
332+
333+
-
334+
message: '#^Cannot access offset 1 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
335+
identifier: offsetAccess.nonOffsetAccessible
336+
count: 1
337+
path: ../tests/Unit/Value/ValueListTest.php
338+
339+
-
340+
message: '#^Cannot access offset 2 on array\<mixed\>\|bool\|float\|int\|string\|null\.$#'
341+
identifier: offsetAccess.nonOffsetAccessible
342+
count: 1
343+
path: ../tests/Unit/Value/ValueListTest.php
344+
345+
-
346+
message: '#^Cannot call method getArrayRepresentation\(\) on Sabberworm\\CSS\\Value\\Value\|string\.$#'
347+
identifier: method.nonObject
348+
count: 1
349+
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)