Skip to content

Commit 03ea4f1

Browse files
committed
Add phpstan config
1 parent a853884 commit 03ea4f1

File tree

4 files changed

+360
-13
lines changed

4 files changed

+360
-13
lines changed

.gitattributes

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
.editorconfig export-ignore
2-
.gitattributes export-ignore
3-
/.github/ export-ignore
4-
.gitignore export-ignore
5-
/.php_cs.dist export-ignore
6-
/.scrutinizer.yml export-ignore
7-
/.styleci.yml export-ignore
8-
/.travis.yml export-ignore
9-
/phpspec.ci.yml export-ignore
10-
/phpspec.yml.dist export-ignore
11-
/phpunit.xml.dist export-ignore
12-
/spec/ export-ignore
13-
/tests/ export-ignore
1+
.editorconfig export-ignore
2+
.gitattributes export-ignore
3+
/.github/ export-ignore
4+
.gitignore export-ignore
5+
/.php_cs.dist export-ignore
6+
/.scrutinizer.yml export-ignore
7+
/.styleci.yml export-ignore
8+
/.travis.yml export-ignore
9+
/phpspec.ci.yml export-ignore
10+
/phpspec.yml.dist export-ignore
11+
/phpstan-baseline.neon export-ignore
12+
/phpstan.neon.dist export-ignore
13+
/phpunit.xml.dist export-ignore
14+
/spec/ export-ignore
15+
/tests/ export-ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
/build/
44
/composer.lock
55
/phpspec.yml
6+
/phpstan.neon
67
/phpunit.xml
78
/vendor/

phpstan-baseline.neon

Lines changed: 337 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Property Http\\\\Message\\\\Authentication\\\\Header\\:\\:\\$value type has no value type specified in iterable type array\\.$#"
5+
count: 1
6+
path: src/Authentication/Header.php
7+
8+
-
9+
message: "#^Method Http\\\\Message\\\\Authentication\\\\Header\\:\\:__construct\\(\\) has parameter \\$value with no typehint specified\\.$#"
10+
count: 1
11+
path: src/Authentication/Header.php
12+
13+
-
14+
message: "#^Property Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:\\$params type has no value type specified in iterable type array\\.$#"
15+
count: 1
16+
path: src/Authentication/QueryParam.php
17+
18+
-
19+
message: "#^Method Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:__construct\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
20+
count: 1
21+
path: src/Authentication/QueryParam.php
22+
23+
-
24+
message: "#^Parameter \\#2 \\$prefix of function http_build_query expects string, null given\\.$#"
25+
count: 1
26+
path: src/Authentication/QueryParam.php
27+
28+
-
29+
message: "#^Parameter \\#1 \\$statusLine of method Http\\\\Message\\\\Builder\\\\ResponseBuilder\\:\\:setStatus\\(\\) expects string, string\\|null given\\.$#"
30+
count: 1
31+
path: src/Builder/ResponseBuilder.php
32+
33+
-
34+
message: "#^Result of \\|\\| is always true\\.$#"
35+
count: 1
36+
path: src/Builder/ResponseBuilder.php
37+
38+
-
39+
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
40+
count: 1
41+
path: src/Builder/ResponseBuilder.php
42+
43+
-
44+
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:createWithoutValidation\\(\\) has no return typehint specified\\.$#"
45+
count: 1
46+
path: src/Cookie.php
47+
48+
-
49+
message: "#^Parameter \\#2 \\$str2 of function strcasecmp expects string, string\\|null given\\.$#"
50+
count: 1
51+
path: src/Cookie.php
52+
53+
-
54+
message: "#^Parameter \\#1 \\$str of function preg_quote expects string, string\\|null given\\.$#"
55+
count: 1
56+
path: src/Cookie.php
57+
58+
-
59+
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateName\\(\\) has no return typehint specified\\.$#"
60+
count: 1
61+
path: src/Cookie.php
62+
63+
-
64+
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateValue\\(\\) has no return typehint specified\\.$#"
65+
count: 1
66+
path: src/Cookie.php
67+
68+
-
69+
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:validateMaxAge\\(\\) has no return typehint specified\\.$#"
70+
count: 1
71+
path: src/Cookie.php
72+
73+
-
74+
message: "#^Method Http\\\\Message\\\\Cookie\\:\\:normalizeDomain\\(\\) should return string but returns string\\|null\\.$#"
75+
count: 1
76+
path: src/Cookie.php
77+
78+
-
79+
message: "#^Parameter \\#1 \\$str of function rtrim expects string, string\\|null given\\.$#"
80+
count: 1
81+
path: src/Cookie.php
82+
83+
-
84+
message: "#^Class Http\\\\Message\\\\CookieJar implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#"
85+
count: 1
86+
path: src/CookieJar.php
87+
88+
-
89+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookie\\(\\) has no return typehint specified\\.$#"
90+
count: 1
91+
path: src/CookieJar.php
92+
93+
-
94+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookie\\(\\) has no return typehint specified\\.$#"
95+
count: 1
96+
path: src/CookieJar.php
97+
98+
-
99+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:findMatchingCookies\\(\\) should return array\\<Http\\\\Message\\\\Cookie\\> but returns array\\<int, object\\>\\.$#"
100+
count: 1
101+
path: src/CookieJar.php
102+
103+
-
104+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:setCookies\\(\\) has no return typehint specified\\.$#"
105+
count: 1
106+
path: src/CookieJar.php
107+
108+
-
109+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:addCookies\\(\\) has no return typehint specified\\.$#"
110+
count: 1
111+
path: src/CookieJar.php
112+
113+
-
114+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeCookies\\(\\) has no return typehint specified\\.$#"
115+
count: 1
116+
path: src/CookieJar.php
117+
118+
-
119+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:removeMatchingCookies\\(\\) has no return typehint specified\\.$#"
120+
count: 1
121+
path: src/CookieJar.php
122+
123+
-
124+
message: "#^Left side of && is always true\\.$#"
125+
count: 1
126+
path: src/CookieJar.php
127+
128+
-
129+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:clear\\(\\) has no return typehint specified\\.$#"
130+
count: 1
131+
path: src/CookieJar.php
132+
133+
-
134+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:count\\(\\) has no return typehint specified\\.$#"
135+
count: 1
136+
path: src/CookieJar.php
137+
138+
-
139+
message: "#^Method Http\\\\Message\\\\CookieJar\\:\\:getIterator\\(\\) return type has no value type specified in iterable type Traversable\\<mixed, mixed\\>\\.$#"
140+
count: 1
141+
path: src/CookieJar.php
142+
143+
-
144+
message: "#^Property Http\\\\Message\\\\CookieUtil\\:\\:\\$dateFormats type has no value type specified in iterable type array\\.$#"
145+
count: 1
146+
path: src/CookieUtil.php
147+
148+
-
149+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:getSize\\(\\) has no return typehint specified\\.$#"
150+
count: 2
151+
path: src/Encoding/FilteredStream.php
152+
153+
-
154+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:isSeekable\\(\\) has no return typehint specified\\.$#"
155+
count: 2
156+
path: src/Encoding/FilteredStream.php
157+
158+
-
159+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
160+
count: 2
161+
path: src/Encoding/FilteredStream.php
162+
163+
-
164+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
165+
count: 2
166+
path: src/Encoding/FilteredStream.php
167+
168+
-
169+
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
170+
count: 1
171+
path: src/Encoding/FilteredStream.php
172+
173+
-
174+
message: "#^Method Http\\\\Message\\\\Encoding\\\\ChunkStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
175+
count: 1
176+
path: src/Encoding/ChunkStream.php
177+
178+
-
179+
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has no return typehint specified\\.$#"
180+
count: 1
181+
path: src/Encoding/Filter/Chunk.php
182+
183+
-
184+
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$closing with no typehint specified\\.$#"
185+
count: 1
186+
path: src/Encoding/Filter/Chunk.php
187+
188+
-
189+
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$consumed with no typehint specified\\.$#"
190+
count: 1
191+
path: src/Encoding/Filter/Chunk.php
192+
193+
-
194+
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$in with no typehint specified\\.$#"
195+
count: 1
196+
path: src/Encoding/Filter/Chunk.php
197+
198+
-
199+
message: "#^Method Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:filter\\(\\) has parameter \\$out with no typehint specified\\.$#"
200+
count: 1
201+
path: src/Encoding/Filter/Chunk.php
202+
203+
-
204+
message: "#^Access to an undefined property Http\\\\Message\\\\Encoding\\\\Filter\\\\Chunk\\:\\:\\$stream\\.$#"
205+
count: 2
206+
path: src/Encoding/Filter/Chunk.php
207+
208+
-
209+
message: "#^Access to an undefined property object\\:\\:\\$datalen\\.$#"
210+
count: 2
211+
path: src/Encoding/Filter/Chunk.php
212+
213+
-
214+
message: "#^Parameter \\#2 \\$bucket of function stream_bucket_append expects object, resource given\\.$#"
215+
count: 2
216+
path: src/Encoding/Filter/Chunk.php
217+
218+
-
219+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
220+
count: 1
221+
path: src/Encoding/Filter/Chunk.php
222+
223+
-
224+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\DiactorosMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
225+
count: 1
226+
path: src/MessageFactory/DiactorosMessageFactory.php
227+
228+
-
229+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\DiactorosMessageFactory\\:\\:createResponse\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
230+
count: 1
231+
path: src/MessageFactory/DiactorosMessageFactory.php
232+
233+
-
234+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\GuzzleMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
235+
count: 1
236+
path: src/MessageFactory/GuzzleMessageFactory.php
237+
238+
-
239+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\GuzzleMessageFactory\\:\\:createResponse\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
240+
count: 1
241+
path: src/MessageFactory/GuzzleMessageFactory.php
242+
243+
-
244+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\SlimMessageFactory\\:\\:createRequest\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
245+
count: 1
246+
path: src/MessageFactory/SlimMessageFactory.php
247+
248+
-
249+
message: "#^Method Http\\\\Message\\\\MessageFactory\\\\SlimMessageFactory\\:\\:createResponse\\(\\) has parameter \\$headers with no value type specified in iterable type array\\.$#"
250+
count: 1
251+
path: src/MessageFactory/SlimMessageFactory.php
252+
253+
-
254+
message: "#^Property Http\\\\Message\\\\RequestMatcher\\\\RequestMatcher\\:\\:\\$methods type has no value type specified in iterable type array\\.$#"
255+
count: 1
256+
path: src/RequestMatcher/RequestMatcher.php
257+
258+
-
259+
message: "#^Property Http\\\\Message\\\\RequestMatcher\\\\RequestMatcher\\:\\:\\$path \\(string\\) does not accept string\\|null\\.$#"
260+
count: 1
261+
path: src/RequestMatcher/RequestMatcher.php
262+
263+
-
264+
message: "#^Property Http\\\\Message\\\\RequestMatcher\\\\RequestMatcher\\:\\:\\$host \\(string\\) does not accept string\\|null\\.$#"
265+
count: 1
266+
path: src/RequestMatcher/RequestMatcher.php
267+
268+
-
269+
message: "#^Property Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:\\$size \\(int\\) does not accept int\\|null\\.$#"
270+
count: 1
271+
path: src/Stream/BufferedStream.php
272+
273+
-
274+
message: "#^Property Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:\\$resource \\(resource\\) does not accept resource\\|false\\.$#"
275+
count: 2
276+
path: src/Stream/BufferedStream.php
277+
278+
-
279+
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#"
280+
count: 1
281+
path: src/Stream/BufferedStream.php
282+
283+
-
284+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:detach\\(\\) should return resource\\|null but empty return statement found\\.$#"
285+
count: 1
286+
path: src/Stream/BufferedStream.php
287+
288+
-
289+
message: "#^Property Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:\\$stream \\(Psr\\\\Http\\\\Message\\\\StreamInterface\\) does not accept null\\.$#"
290+
count: 1
291+
path: src/Stream/BufferedStream.php
292+
293+
-
294+
message: "#^Property Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:\\$resource \\(resource\\) does not accept null\\.$#"
295+
count: 1
296+
path: src/Stream/BufferedStream.php
297+
298+
-
299+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:getSize\\(\\) should return int\\|null but empty return statement found\\.$#"
300+
count: 1
301+
path: src/Stream/BufferedStream.php
302+
303+
-
304+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:tell\\(\\) should return int but returns int\\|false\\.$#"
305+
count: 1
306+
path: src/Stream/BufferedStream.php
307+
308+
-
309+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:seek\\(\\) has no return typehint specified\\.$#"
310+
count: 1
311+
path: src/Stream/BufferedStream.php
312+
313+
-
314+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:rewind\\(\\) has no return typehint specified\\.$#"
315+
count: 1
316+
path: src/Stream/BufferedStream.php
317+
318+
-
319+
message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#"
320+
count: 1
321+
path: src/Stream/BufferedStream.php
322+
323+
-
324+
message: "#^Method Http\\\\Message\\\\Stream\\\\BufferedStream\\:\\:read\\(\\) should return string but returns string\\|false\\.$#"
325+
count: 1
326+
path: src/Stream/BufferedStream.php
327+
328+
-
329+
message: "#^Parameter \\#1 \\$stream of class Slim\\\\Http\\\\Stream constructor expects resource, resource\\|false given\\.$#"
330+
count: 1
331+
path: src/StreamFactory/SlimStreamFactory.php
332+
333+
-
334+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
335+
count: 1
336+
path: src/UriFactory/SlimUriFactory.php
337+

phpstan.neon.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: max
6+
paths:
7+
- src

0 commit comments

Comments
 (0)