Skip to content

Commit 27c4bcf

Browse files
committed
uses nette/phpstan-rules
1 parent 48aa123 commit 27c4bcf

File tree

6 files changed

+421
-5
lines changed

6 files changed

+421
-5
lines changed

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"nette/tester": "^2.6",
2727
"latte/latte": "^2.10.2 || ^3.0.12",
2828
"tracy/tracy": "^2.9",
29-
"phpstan/phpstan-nette": "^2.0@stable"
29+
"phpstan/phpstan": "^2.1@stable",
30+
"phpstan/extension-installer": "^1.4@stable",
31+
"nette/phpstan-rules": "^1.0"
3032
},
3133
"conflict": {
3234
"latte/latte": ">=3.0.0 <3.0.12 || >=3.2"
@@ -49,5 +51,10 @@
4951
"branch-alias": {
5052
"dev-master": "3.2-dev"
5153
}
54+
},
55+
"config": {
56+
"allow-plugins": {
57+
"phpstan/extension-installer": true
58+
}
5259
}
5360
}

phpstan-baseline.neon

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Using nullsafe property access on non\-nullable type Latte\\Compiler\\Nodes\\FragmentNode\. Use \-\> instead\.$#'
5+
identifier: nullsafe.neverNull
6+
count: 1
7+
path: src/Bridges/FormsLatte/Nodes/FieldNNameNode.php
8+
9+
-
10+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getControl\(\)\.$#'
11+
identifier: method.notFound
12+
count: 1
13+
path: src/Bridges/FormsLatte/Runtime.php
14+
15+
-
16+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getOption\(\)\.$#'
17+
identifier: method.notFound
18+
count: 2
19+
path: src/Bridges/FormsLatte/Runtime.php
20+
21+
-
22+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:setOption\(\)\.$#'
23+
identifier: method.notFound
24+
count: 1
25+
path: src/Bridges/FormsLatte/Runtime.php
26+
27+
-
28+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:lookupPath\(\)\.$#'
29+
identifier: method.notFound
30+
count: 1
31+
path: src/Forms/Blueprint.php
32+
33+
-
34+
message: '#^Method Nette\\Forms\\Controls\\BaseControl@anonymous/Forms/Blueprint\.php\:97\:\:getControl\(\) never returns Nette\\Utils\\Html so it can be removed from the return type\.$#'
35+
identifier: return.unusedType
36+
count: 1
37+
path: src/Forms/Blueprint.php
38+
39+
-
40+
message: '#^Method Nette\\Forms\\Controls\\BaseControl@anonymous/Forms/Blueprint\.php\:97\:\:getLabel\(\) never returns Nette\\Utils\\Html so it can be removed from the return type\.$#'
41+
identifier: return.unusedType
42+
count: 1
43+
path: src/Forms/Blueprint.php
44+
45+
-
46+
message: '#^Method Nette\\Forms\\Form@anonymous/Forms/Blueprint\.php\:89\:\:receiveHttpData\(\) never returns null so it can be removed from the return type\.$#'
47+
identifier: return.unusedType
48+
count: 1
49+
path: src/Forms/Blueprint.php
50+
51+
-
52+
message: '#^Property Nette\\Forms\\Controls\\BaseControl@anonymous/Forms/Blueprint\.php\:97\:\:\$inner has no type specified\.$#'
53+
identifier: missingType.property
54+
count: 1
55+
path: src/Forms/Blueprint.php
56+
57+
-
58+
message: '#^Call to an undefined method Nette\\ComponentModel\\IComponent&Nette\\Forms\\Control\:\:isDisabled\(\)\.$#'
59+
identifier: method.notFound
60+
count: 1
61+
path: src/Forms/Container.php
62+
63+
-
64+
message: '#^Method Nette\\Forms\\Container\:\:getUnsafeValues\(\) has no return type specified\.$#'
65+
identifier: missingType.return
66+
count: 1
67+
path: src/Forms/Container.php
68+
69+
-
70+
message: '#^Method Nette\\Forms\\Container\:\:getUnsafeValues\(\) has parameter \$controls with no value type specified in iterable type array\.$#'
71+
identifier: missingType.iterableValue
72+
count: 1
73+
path: src/Forms/Container.php
74+
75+
-
76+
message: '#^Method Nette\\Forms\\Container\:\:getUnsafeValues\(\) has parameter \$returnType with no type specified\.$#'
77+
identifier: missingType.parameter
78+
count: 1
79+
path: src/Forms/Container.php
80+
81+
-
82+
message: '#^Parameter \#1 \.\.\.\$items of method Nette\\Forms\\ControlGroup\:\:add\(\) expects iterable\<Nette\\Forms\\Container\|Nette\\Forms\\Control\>\|Nette\\Forms\\Container\|Nette\\Forms\\Control, Nette\\ComponentModel\\IComponent given\.$#'
83+
identifier: argument.type
84+
count: 1
85+
path: src/Forms/Container.php
86+
87+
-
88+
message: '#^Unable to resolve the template type T in call to method Nette\\Forms\\Container\:\:getUntrustedValues\(\)$#'
89+
identifier: argument.templateType
90+
count: 1
91+
path: src/Forms/Container.php
92+
93+
-
94+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getForm\(\)\.$#'
95+
identifier: method.notFound
96+
count: 1
97+
path: src/Forms/ControlGroup.php
98+
99+
-
100+
message: '#^Parameter \#1 \.\.\.\$items of method Nette\\Forms\\ControlGroup\:\:add\(\) expects iterable\<Nette\\Forms\\Container\|Nette\\Forms\\Control\>\|Nette\\Forms\\Container\|Nette\\Forms\\Control, Nette\\ComponentModel\\IComponent given\.$#'
101+
identifier: argument.type
102+
count: 1
103+
path: src/Forms/ControlGroup.php
104+
105+
-
106+
message: '#^Method Nette\\Forms\\Controls\\BaseControl\:\:getHttpData\(\) has parameter \$type with no type specified\.$#'
107+
identifier: missingType.parameter
108+
count: 1
109+
path: src/Forms/Controls/BaseControl.php
110+
111+
-
112+
message: '#^Method Nette\\Forms\\Controls\\BaseControl\:\:getOption\(\) has parameter \$key with no type specified\.$#'
113+
identifier: missingType.parameter
114+
count: 1
115+
path: src/Forms/Controls/BaseControl.php
116+
117+
-
118+
message: '#^Method Nette\\Forms\\Controls\\BaseControl\:\:setOption\(\) has parameter \$key with no type specified\.$#'
119+
identifier: missingType.parameter
120+
count: 1
121+
path: src/Forms/Controls/BaseControl.php
122+
123+
-
124+
message: '#^Method Nette\\Forms\\Controls\\Button\:\:getLabel\(\) has parameter \$caption with no type specified\.$#'
125+
identifier: missingType.parameter
126+
count: 1
127+
path: src/Forms/Controls/Button.php
128+
129+
-
130+
message: '#^Method Nette\\Forms\\Controls\\Checkbox\:\:getLabel\(\) has parameter \$caption with no type specified\.$#'
131+
identifier: missingType.parameter
132+
count: 1
133+
path: src/Forms/Controls/Checkbox.php
134+
135+
-
136+
message: '#^Method Nette\\Forms\\Controls\\CheckboxList\:\:getControlPart\(\) has parameter \$key with no type specified\.$#'
137+
identifier: missingType.parameter
138+
count: 1
139+
path: src/Forms/Controls/CheckboxList.php
140+
141+
-
142+
message: '#^Method Nette\\Forms\\Controls\\CheckboxList\:\:getLabel\(\) has parameter \$caption with no type specified\.$#'
143+
identifier: missingType.parameter
144+
count: 1
145+
path: src/Forms/Controls/CheckboxList.php
146+
147+
-
148+
message: '#^Method Nette\\Forms\\Controls\\CheckboxList\:\:getLabelPart\(\) has parameter \$key with no type specified\.$#'
149+
identifier: missingType.parameter
150+
count: 1
151+
path: src/Forms/Controls/CheckboxList.php
152+
153+
-
154+
message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#'
155+
identifier: function.alreadyNarrowedType
156+
count: 1
157+
path: src/Forms/Controls/ColorPicker.php
158+
159+
-
160+
message: '#^Match expression does not handle remaining values\: int\<min, 0\>\|int\<4, max\>$#'
161+
identifier: match.unhandled
162+
count: 4
163+
path: src/Forms/Controls/DateTimeControl.php
164+
165+
-
166+
message: '#^Method Nette\\Forms\\Controls\\HiddenField\:\:getLabel\(\) has parameter \$caption with no type specified\.$#'
167+
identifier: missingType.parameter
168+
count: 1
169+
path: src/Forms/Controls/HiddenField.php
170+
171+
-
172+
message: '#^Method Nette\\Forms\\Controls\\RadioList\:\:getControlPart\(\) has parameter \$key with no type specified\.$#'
173+
identifier: missingType.parameter
174+
count: 1
175+
path: src/Forms/Controls/RadioList.php
176+
177+
-
178+
message: '#^Method Nette\\Forms\\Controls\\RadioList\:\:getLabel\(\) has parameter \$caption with no type specified\.$#'
179+
identifier: missingType.parameter
180+
count: 1
181+
path: src/Forms/Controls/RadioList.php
182+
183+
-
184+
message: '#^Method Nette\\Forms\\Controls\\RadioList\:\:getLabelPart\(\) has parameter \$key with no type specified\.$#'
185+
identifier: missingType.parameter
186+
count: 1
187+
path: src/Forms/Controls/RadioList.php
188+
189+
-
190+
message: '#^Method Nette\\Forms\\Controls\\SubmitButton\:\:getControl\(\) has parameter \$caption with no type specified\.$#'
191+
identifier: missingType.parameter
192+
count: 1
193+
path: src/Forms/Controls/SubmitButton.php
194+
195+
-
196+
message: '#^Call to an undefined method Nette\\ComponentModel\\IComponent\:\:getValue\(\)\.$#'
197+
identifier: method.notFound
198+
count: 1
199+
path: src/Forms/Form.php
200+
201+
-
202+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getParent\(\)\.$#'
203+
identifier: method.notFound
204+
count: 1
205+
path: src/Forms/Form.php
206+
207+
-
208+
message: '#^Method Nette\\Forms\\Form\:\:beforeRender\(\) has no return type specified\.$#'
209+
identifier: missingType.return
210+
count: 1
211+
path: src/Forms/Form.php
212+
213+
-
214+
message: '#^Method Nette\\Forms\\Form\:\:invokeHandlers\(\) has parameter \$handlers with no signature specified for callable\.$#'
215+
identifier: missingType.callable
216+
count: 1
217+
path: src/Forms/Form.php
218+
219+
-
220+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getHtmlName\(\)\.$#'
221+
identifier: method.notFound
222+
count: 2
223+
path: src/Forms/Helpers.php
224+
225+
-
226+
message: '#^Method Nette\\Forms\\Helpers\:\:sanitize\(\) never returns array\<mixed\> so it can be removed from the return type\.$#'
227+
identifier: return.unusedType
228+
count: 1
229+
path: src/Forms/Helpers.php
230+
231+
-
232+
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(Nette\\Utils\\ImageType\)\: mixed\)\|null, Closure\(1\|2\|3\|6\|18\|19\)\: string given\.$#'
233+
identifier: argument.type
234+
count: 1
235+
path: src/Forms/Helpers.php
236+
237+
-
238+
message: '#^Strict comparison using \=\=\= between '''' and '''' will always evaluate to true\.$#'
239+
identifier: identical.alwaysTrue
240+
count: 1
241+
path: src/Forms/Helpers.php
242+
243+
-
244+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getControl\(\)\.$#'
245+
identifier: method.notFound
246+
count: 2
247+
path: src/Forms/Rendering/DefaultFormRenderer.php
248+
249+
-
250+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getForm\(\)\.$#'
251+
identifier: method.notFound
252+
count: 2
253+
path: src/Forms/Rendering/DefaultFormRenderer.php
254+
255+
-
256+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getLabel\(\)\.$#'
257+
identifier: method.notFound
258+
count: 1
259+
path: src/Forms/Rendering/DefaultFormRenderer.php
260+
261+
-
262+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getOption\(\)\.$#'
263+
identifier: method.notFound
264+
count: 12
265+
path: src/Forms/Rendering/DefaultFormRenderer.php
266+
267+
-
268+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:hasErrors\(\)\.$#'
269+
identifier: method.notFound
270+
count: 3
271+
path: src/Forms/Rendering/DefaultFormRenderer.php
272+
273+
-
274+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:isRequired\(\)\.$#'
275+
identifier: method.notFound
276+
count: 4
277+
path: src/Forms/Rendering/DefaultFormRenderer.php
278+
279+
-
280+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:setOption\(\)\.$#'
281+
identifier: method.notFound
282+
count: 3
283+
path: src/Forms/Rendering/DefaultFormRenderer.php
284+
285+
-
286+
message: '#^Instanceof between Nette\\Forms\\Control and Nette\\Forms\\Control will always evaluate to true\.$#'
287+
identifier: instanceof.alwaysTrue
288+
count: 1
289+
path: src/Forms/Rendering/DefaultFormRenderer.php
290+
291+
-
292+
message: '#^Variable \$control might not be defined\.$#'
293+
identifier: variable.undefined
294+
count: 1
295+
path: src/Forms/Rendering/DefaultFormRenderer.php
296+
297+
-
298+
message: '#^Access to an undefined property Nette\\Forms\\Control\:\:\$name\.$#'
299+
identifier: property.notFound
300+
count: 1
301+
path: src/Forms/Rules.php
302+
303+
-
304+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:addError\(\)\.$#'
305+
identifier: method.notFound
306+
count: 1
307+
path: src/Forms/Rules.php
308+
309+
-
310+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:isFilled\(\)\.$#'
311+
identifier: method.notFound
312+
count: 2
313+
path: src/Forms/Rules.php
314+
315+
-
316+
message: '#^Method Nette\\Forms\\Rules\:\:getCallback\(\) return type has no signature specified for callable\.$#'
317+
identifier: missingType.callable
318+
count: 1
319+
path: src/Forms/Rules.php
320+
321+
-
322+
message: '#^Method Nette\\Forms\\Rules\:\:getCallback\(\) return type has no value type specified in iterable type array\.$#'
323+
identifier: missingType.iterableValue
324+
count: 1
325+
path: src/Forms/Rules.php
326+
327+
-
328+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getForm\(\)\.$#'
329+
identifier: method.notFound
330+
count: 1
331+
path: src/Forms/Validator.php
332+
333+
-
334+
message: '#^Call to an undefined method Nette\\Forms\\Control\:\:getName\(\)\.$#'
335+
identifier: method.notFound
336+
count: 2
337+
path: src/Forms/Validator.php
338+
339+
-
340+
message: '#^Call to an undefined method Nette\\HtmlStringable\:\:getText\(\)\.$#'
341+
identifier: method.notFound
342+
count: 1
343+
path: src/Forms/Validator.php

phpstan.neon

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
parameters:
2-
level: 5
2+
level: 6
33

44
paths:
55
- src
66

7-
treatPhpDocTypesAsCertain: false
7+
excludePaths:
8+
- src/Bridges/FormsLatte/FormMacros.php
9+
- src/compatibility.php
810

11+
ignoreErrors:
12+
- # Latte nodes use new static() by design for extensibility
13+
identifier: new.static
14+
path: src/Bridges/FormsLatte/Nodes/*
915

1016
includes:
11-
- vendor/phpstan/phpstan-nette/extension.neon
17+
- phpstan-baseline.neon

0 commit comments

Comments
 (0)