-
Notifications
You must be signed in to change notification settings - Fork 3
/
phpstan.neon
218 lines (170 loc) · 8.48 KB
/
phpstan.neon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
includes:
- %rootDir%/conf/bleedingEdge.neon
- %rootDir%/../phpstan-strict-rules/rules.neon
- %rootDir%/../../forrest79/phpgsql-phpstan/extension.neon
parameters:
level: max
ignoreErrors:
# === This is OK ===
-
message: '#^Unsafe usage of new static\(\)\.$#'
path: %rootDir%/../../../src/Db/Row.php
count: 1
# === This is OK (just for tests or benchmarks) ===
-
message: '#^Parameter \#1 \$result of function pg_.+ expects PgSql\\Result, PgSql\\Result\|false given\.$#'
path: %rootDir%/../../../tests/Integration/PgFunctionsTest.php
count: 47
-
message: '#^Parameter \#2 \$queryParams of method Forrest79\\PhPgSql\\Fluent\\QueryBuilder::createSqlQuery\(\) expects array\{.+\}, array\{.*\} given\.$#'
path: %rootDir%/../../../tests/Unit/FluentQueryTest.php
count: 1
-
message: '#^Parameter \#1 \$columns of method Forrest79\\PhPgSql\\Fluent\\Query::select\(\) expects array\<int\|string, BackedEnum\|bool\|Forrest79\\PhPgSql\\Db\\Sql\|Forrest79\\PhPgSql\\Fluent\\Query\|int\|string\|null\>, array\<string, array\<int, string\>\> given\.$#'
path: %rootDir%/../../../tests/Unit/FluentQueryTest.php
count: 1
-
message: '#^AnonymousClass.+::__construct\(\) does not call parent constructor from Forrest79\\PhPgSql\\Db\\PreparedStatementHelper\.$#'
path: %rootDir%/../../../tests/Unit/QueryTest.php
count: 1
-
message: '#^Call to an undefined method Forrest79\\PhPgSql\\Db\\Result::fetchOrException\(\)\.$#'
path: %rootDir%/../../../tests/Integration/CustomResultTest.php
count: 2
-
message: '#^Binary operation ".=?" between .+ results in an error\.$#'
path: %rootDir%/../../../tests/Integration/FetchMutatorTest.php
count: 25
-
message: '#^Expression ".+" on a separate line does not do anything\.$#'
path: %rootDir%/../../../tests/Integration/FetchTest.php
count: 8
-
message: '#^Offset 1 does not exist on Forrest79\\PhPgSql\\Db\\Row\.$#'
path: %rootDir%/../../../tests/Integration/FetchTest.php
count: 1
-
message: '#^Cannot assign offset 1 to Forrest79\\PhPgSql\\Db\\Row\.$#'
path: %rootDir%/../../../tests/Integration/FetchTest.php
count: 1
-
message: '#^Offset 1 on Forrest79\\PhPgSql\\Db\\Row in isset\(\) does not exist\.$#'
path: %rootDir%/../../../tests/Integration/FetchTest.php
count: 1
-
message: '#^Cannot unset offset 1 on Forrest79\\PhPgSql\\Db\\Row\.$#'
path: %rootDir%/../../../tests/Integration/FetchTest.php
count: 1
-
message: '#^Expression ".+" on a separate line does not do anything\.$#'
path: %rootDir%/../../../tests/Integration/ParseDataTypeTest.php
count: 4
-
message: "#^Call to function array_key_exists\\(\\) with '.+' and array\\{.+\\} will always evaluate to (true|false)\\.$#"
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 10
-
message: '#^Call to function array_key_exists\(\) on a separate line has no effect\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 2
-
message: '#^Offset 0 on (array\{1\}|null) on left side of \?\? .+\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 2
-
message: "#^Offset '[a-zA-Z0-9]+' on array\\{.+\\} in isset\\(\\) .+\\.$#"
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 8
-
message: '#^Empty array passed to foreach\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 1
-
message: '#^Call to function hrtime\(\) on a separate line has no effect\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 1
-
message: '#^Strict comparison using \!\=\= between array\{\} and array\{\} will always evaluate to false\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 1
-
message: '#^Unused result of "\|\|" operator\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 8
-
message: '#^Call to new Forrest79\\PhPgSql\\Db\\Sql\\Literal\(\) on a separate line has no effect\.$#'
path: %rootDir%/../../../benchmarks/BasicPhpBenchmark.php
count: 1
-
message: '#^Strict comparison using \!\=\= between array\<int, string\> and null will always evaluate to true\.$#'
path: %rootDir%/../../../benchmarks/GetFieldTypesBenchmark.php
count: 3
# === Explicit mixed check (correct type is checked in tests)
-
message: '#^Cannot call method toArray\(\) on mixed\.$#'
path: %rootDir%/../../../tests/Integration/BasicTest.php
count: 1
-
message: '#^Cannot access offset [012] on mixed\.$#'
path: %rootDir%/../../../tests/Integration/ParseDataTypeTest.php
count: 63
-
message: '#^Cannot access offset [01] on mixed\.$#'
path: %rootDir%/../../../tests/Unit/ParseDataTypeTest.php
count: 11
-
message: '#^Cannot call method format\(\) on mixed\.$#'
path: %rootDir%/../../../tests/Unit/ParseDataTypeTest.php
count: 17
# === We know, that this can happen ===
-
message: '#^Instanceof between .+ and .+ will always evaluate to (true|false)\.$#'
path: %rootDir%/../../../src/Fluent/Query.php
count: 3
-
message: '#^Result of && is always false\.$#'
path: %rootDir%/../../../src/Fluent/Query.php
count: 3
-
message: "#^Strict comparison using === between 'suffix' and 'suffix' will always evaluate to true\\.$#"
path: %rootDir%/../../../src/Fluent/QueryBuilder.php
count: 1
-
message: '#^Unreachable statement - code above always terminates\.$#'
path: %rootDir%/../../../src/Fluent/QueryBuilder.php
count: 1
-
message: "#^Offset 'prefix'\\|'suffix' on array\\{select\\: array\\<int\\|string, BackedEnum\\|Forrest79\\\\PhPgSql\\\\Db\\\\Sql\\|Forrest79\\\\PhPgSql\\\\Fluent\\\\Query\\|int\\|string\\>, distinct\\: bool, distinctOn\\: list\\<string\\>, tables\\: array\\<string, array\\{string, string\\}\\>, table\\-types\\: array\\{main\\: string\\|null, from\\: list\\<string\\>, joins\\: list\\<string\\>, using\\: string\\|null\\}, on\\-conditions\\: array\\<string, Forrest79\\\\PhPgSql\\\\Fluent\\\\Complex\\>, lateral\\-tables\\: array\\<string, string\\>, where\\: Forrest79\\\\PhPgSql\\\\Fluent\\\\Complex\\|null, \\.\\.\\.\\} on left side of \\?\\? always exists and is not nullable\\.$#"
path: %rootDir%/../../../src/Fluent/QueryBuilder.php
count: 1
# === We know, that this can't happen ===
-
message: '#^Property Forrest79\\PhPgSql\\Fluent\\Complex::\$conditions \(list\<list\<mixed\>\|Forrest79\\PhPgSql\\Fluent\\Complex\>\) does not accept non\-empty\-array\<int, list\<mixed\>\|Forrest79\\PhPgSql\\Fluent\\Complex\>\.$#'
path: %rootDir%/../../../src/Fluent/Complex.php
count: 1
-
message: '#^Parameter \#2 \$rawValues of method Forrest79\\PhPgSql\\Db\\RowFactory::createRow\(\) expects array\<string, string\|null\>, array\<int\|string, string\|null\> given\.$#'
path: %rootDir%/../../../src/Db/Result.php
count: 1
-
message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#'
path: %rootDir%/../../../src/Db/Row.php
count: 3
-
message: '#^Method Forrest79\\PhPgSql\\Db\\RowIterator::current\(\) should return Forrest79\\PhPgSql\\Db\\Row but returns Forrest79\\PhPgSql\\Db\\Row\|null\.$#'
path: %rootDir%/../../../src/Db/RowIterator.php
count: 1
-
message: '#^Parameter \#2 \$expected of static method Forrest79\\PhPgSql\\Fluent\\Exceptions\\QueryBuilderException::badParamsCount\(\) expects int, int(\<0, max\>)?\|false(\|null)? given\.$#' # (|null)? is for forward PHP 8 compatibility
path: %rootDir%/../../../src/Fluent/QueryBuilder.php
count: 1
# === PHPStan imperfection ===
-
message: "#^Property Forrest79\\\\PhPgSql\\\\Fluent\\\\Query::\\$params \\(array\\{select: array\\<int\\|string, BackedEnum\\|Forrest79\\\\PhPgSql\\\\Db\\\\Sql\\|Forrest79\\\\PhPgSql\\\\Fluent\\\\Query\\|int\\|string\\>, distinct: bool, distinctOn: list\\<string\\>, tables: array\\<string, array\\{string, string\\}\\>, table\\-types: array\\{main: string\\|null, from: list\\<string\\>, joins: list\\<string\\>, using: string\\|null\\}, on\\-conditions: array\\<string, Forrest79\\\\PhPgSql\\\\Fluent\\\\Complex\\>, lateral\\-tables: array\\<string, string\\>, where: Forrest79\\\\PhPgSql\\\\Fluent\\\\Complex\\|null, \\.\\.\\.\\}\\) does not accept .+\\.$#"
path: src/Fluent/Query.php
count: 6
# === Fix PhPgSql-PHPStan rules ===
-
message: '#^Method Forrest79\\PhPgSql\\Fluent\\QueryExecute::getIterator\(\) should return Forrest79\\PhPgSql\\Db\\RowIterator but returns iterable<int, Forrest79\\PhPgSql\\Db\\Row>\.$#'
path: %rootDir%/../../../src/Fluent/QueryExecute.php
count: 1