-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathphpstan.neon
More file actions
581 lines (481 loc) · 19.3 KB
/
phpstan.neon
File metadata and controls
581 lines (481 loc) · 19.3 KB
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
includes:
- %rootDir%/conf/bleedingEdge.neon
- %rootDir%/../phpstan-strict-rules/rules.neon
- %rootDir%/../../../vendor/shipmonk/phpstan-rules/rules.neon
- %rootDir%/../../forrest79/phpgsql-phpstan/extension.neon
parameters:
level: max
shipmonkRules:
forbidCheckedExceptionInCallable:
enabled: false
ignoreErrors:
# === This is OK ===
-
rawMessage: 'Method Forrest79\PhPgSql\Db\DataTypeCaches\PhpFile::load() should return array<int, string> but returns mixed.'
identifier: return.type
count: 1
path: src/Db/DataTypeCaches/PhpFile.php
-
rawMessage: 'Property Forrest79\PhPgSql\Db\DataTypeCaches\PhpFile::$cache (array<string, array<int, string>>) does not accept array<string, mixed>.'
identifier: assign.propertyType
count: 1
path: src/Db/DataTypeCaches/PhpFile.php
-
rawMessage: Overwriting variable $value while changing its type from BackedEnum to int|string
identifier: shipmonk.variableTypeOverwritten
count: 1
path: src/Db/Helper.php
-
rawMessage: Overwriting variable $query while changing its type from string to Forrest79\PhPgSql\Db\Sql\Query
identifier: shipmonk.variableTypeOverwritten
count: 1
path: src/Db/Query.php
-
rawMessage: 'Array key must be integer or string, but bool|float|int|string|null given.'
identifier: shipmonk.unsafeArrayKey
count: 1
path: src/Db/Result.php
-
rawMessage: Cannot access an offset on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/Db/Result.php
-
rawMessage: Cannot access offset string on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 1
path: src/Db/Result.php
-
rawMessage: Possibly invalid array key type bool|float|int|string|null.
identifier: offsetAccess.invalidOffset
count: 1
path: src/Db/Result.php
-
rawMessage: 'Unsafe usage of new static().'
identifier: new.static
count: 1
path: src/Db/Row.php
-
rawMessage: 'Overwriting variable $value while changing its type from Forrest79\PhPgSql\Db\Sql|string to array<int, Forrest79\PhPgSql\Db\Sql|string>'
identifier: shipmonk.variableTypeOverwritten
count: 1
path: src/Fluent/Condition.php
-
rawMessage: 'Unsafe usage of new static().'
identifier: new.static
count: 2
path: src/Fluent/Condition.php
-
rawMessage: Overwriting variable $column while changing its type from bool to string
identifier: shipmonk.variableTypeOverwritten
count: 2
path: src/Fluent/Query.php
-
rawMessage: Overwriting variable $query while changing its type from Forrest79\PhPgSql\Db\Sql to string
identifier: shipmonk.variableTypeOverwritten
count: 2
path: src/Fluent/QueryBuilder.php
-
rawMessage: Overwriting variable $table while changing its type from Forrest79\PhPgSql\Db\Sql to string
identifier: shipmonk.variableTypeOverwritten
count: 2
path: src/Fluent/QueryBuilder.php
-
rawMessage: Overwriting variable $then while changing its type from Forrest79\PhPgSql\Db\Sql to string
identifier: shipmonk.variableTypeOverwritten
count: 1
path: src/Fluent/QueryBuilder.php
-
rawMessage: Overwriting variable $value while changing its type from Forrest79\PhPgSql\Db\Sql to string
identifier: shipmonk.variableTypeOverwritten
count: 4
path: src/Fluent/QueryBuilder.php
# === This is OK (just for tests or benchmarks) ===
-
rawMessage: 'Call to function array_key_exists() on a separate line has no effect.'
identifier: function.resultUnused
count: 2
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Call to function array_key_exists() with ''testKey'' and array{testKey1: null, testKey2: ''''} will always evaluate to false.'
identifier: function.impossibleType
count: 2
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Call to function array_key_exists() with ''testKey1'' and array{testKey1: null, testKey2: ''''} will always evaluate to true.'
identifier: function.alreadyNarrowedType
count: 4
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Call to function array_key_exists() with ''testKey2'' and array{testKey1: null, testKey2: ''''} will always evaluate to true.'
identifier: function.alreadyNarrowedType
count: 1
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Call to function array_key_exists() with ''testKey2'' and *NEVER* will always evaluate to true.'
identifier: function.alreadyNarrowedType
count: 3
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: Empty array passed to foreach.
identifier: foreach.emptyArray
count: 1
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Offset ''testKey'' on array{testKey1: null, testKey2: ''''} in isset() does not exist.'
identifier: isset.offset
count: 2
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Offset ''testKey1'' on array{testKey1: null, testKey2: ''''} in isset() always exists and is always null.'
identifier: isset.offset
count: 3
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Offset ''testKey2'' on array{testKey1: null, testKey2: ''''} in isset() always exists and is not nullable.'
identifier: isset.offset
count: 3
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Offset 0 on array{1} on left side of ?? always exists and is not nullable.'
identifier: nullCoalesce.offset
count: 1
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: Offset 0 on null on left side of ?? does not exist.
identifier: nullCoalesce.offset
count: 1
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Overwriting variable $keys while changing its type from array<int, string> to string'
identifier: shipmonk.variableTypeOverwritten
count: 2
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Overwriting variable $test while changing its type from array<int, int> to array<int, float>'
identifier: shipmonk.variableTypeOverwritten
count: 2
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Strict comparison using !== between array{} and array{} will always evaluate to false.'
identifier: notIdentical.alwaysFalse
count: 1
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: Unused result of "||" operator.
identifier: booleanOr.resultUnused
count: 8
path: benchmarks/BasicPhpBenchmark.php
-
rawMessage: 'Strict comparison using !== between array<int, string> and null will always evaluate to true.'
identifier: notIdentical.alwaysTrue
count: 3
path: benchmarks/GetFieldTypesBenchmark.php
-
rawMessage: 'Cannot call method toArray() on mixed.'
identifier: method.nonObject
count: 1
path: tests/Integration/BasicTest.php
-
rawMessage: 'Call to an undefined method Forrest79\PhPgSql\Db\Result::fetchOrException().'
identifier: method.notFound
count: 2
path: tests/Integration/CustomResultTest.php
-
rawMessage: Cannot access property $name on mixed.
identifier: property.nonObject
count: 1
path: tests/Integration/CustomResultTest.php
-
rawMessage: Overwriting variable $value while changing its type from DateTimeImmutable to string
identifier: shipmonk.variableTypeOverwritten
count: 1
path: tests/Integration/DocsTest.php
-
rawMessage: 'Overwriting variable $value while changing its type from array<mixed, mixed> to string'
identifier: shipmonk.variableTypeOverwritten
count: 1
path: tests/Integration/DocsTest.php
-
rawMessage: Overwriting variable $value while changing its type from bool to string
identifier: shipmonk.variableTypeOverwritten
count: 1
path: tests/Integration/DocsTest.php
-
rawMessage: 'Overwriting variable $var while changing its type from Forrest79\PhPgSql\Db\Row to array<string, mixed>'
identifier: shipmonk.variableTypeOverwritten
count: 1
path: tests/Integration/DocsTest.php
-
rawMessage: Binary operation "+" between mixed and 1 results in an error.
identifier: binaryOp.invalid
count: 3
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between 'NAME' and mixed results in an error.
identifier: binaryOp.invalid
count: 1
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between 'NAME_' and mixed results in an error.
identifier: binaryOp.invalid
count: 1
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between 'id' and mixed results in an error.
identifier: binaryOp.invalid
count: 1
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between 'type' and mixed results in an error.
identifier: binaryOp.invalid
count: 1
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between mixed and '-' results in an error.
identifier: binaryOp.invalid
count: 10
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Binary operation "." between non-falsy-string and mixed results in an error.
identifier: binaryOp.invalid
count: 10
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: 'Binary operation ".=" between mixed and ''-rowMutated'' results in an error.'
identifier: assignOp.invalid
count: 1
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: 'Using + over non-number (mixed + int)'
identifier: shipmonk.arithmeticOnNonNumber
count: 3
path: tests/Integration/FetchMutatorTest.php
-
rawMessage: Cannot assign offset 1 to Forrest79\PhPgSql\Db\Row.
identifier: offsetAssign.dimType
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: Cannot unset offset 1 on Forrest79\PhPgSql\Db\Row.
identifier: unset.offset
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: Expression "$row->cnt" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: Expression "$row->column" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: Expression "$row->type" on a separate line does not do anything.
identifier: expr.resultUnused
count: 2
path: tests/Integration/FetchTest.php
-
rawMessage: 'Expression "$row[''another_type'']" on a separate line does not do anything.'
identifier: expr.resultUnused
count: 2
path: tests/Integration/FetchTest.php
-
rawMessage: 'Expression "$row[1]" on a separate line does not do anything.'
identifier: expr.resultUnused
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: 'Expression "isset($row[1])" on a separate line does not do anything.'
identifier: expr.resultUnused
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: Offset 1 does not exist on Forrest79\PhPgSql\Db\Row.
identifier: offsetAccess.notFound
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: 'Offset 1 on Forrest79\PhPgSql\Db\Row in isset() does not exist.'
identifier: isset.offset
count: 1
path: tests/Integration/FetchTest.php
-
rawMessage: 'Unsetting class field is forbidden as it causes un-initialization, assign null instead'
identifier: shipmonk.unsettingClassProperty
count: 2
path: tests/Integration/FetchTest.php
-
rawMessage: Cannot access offset 0 on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 41
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Cannot access offset 1 on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 12
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Cannot access offset 2 on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 10
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Expression "$row->type_hstore" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Expression "$row->type_money" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Expression "$row->type_point" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: Expression "$row->type_tsvector" on a separate line does not do anything.
identifier: expr.resultUnused
count: 1
path: tests/Integration/ParseDataTypeTest.php
-
rawMessage: 'Parameter #1 $result of function pg_affected_rows expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 1
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_fetch_assoc expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 19
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_field_name expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 2
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_field_type expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 2
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_field_type_oid expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 2
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_free_result expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 2
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_num_fields expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 1
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_num_rows expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 1
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_result_error expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 1
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_result_error_field expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 12
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $result of function pg_result_status expects PgSql\Result, PgSql\Result|false given.'
identifier: argument.type
count: 4
path: tests/Integration/PgFunctionsTest.php
-
rawMessage: 'Parameter #1 $columns of method Forrest79\PhPgSql\Fluent\Query::select() expects array<int|string, BackedEnum|bool|Forrest79\PhPgSql\Db\Sql|int|string|null>, array<string, array<int, string>> given.'
identifier: argument.type
count: 1
path: tests/Unit/FluentQueryTest.php
-
rawMessage: 'Parameter #2 $queryParams of method Forrest79\PhPgSql\Fluent\QueryBuilder::createSqlDefinition() expects array{select: array<int|string, BackedEnum|Forrest79\PhPgSql\Db\Sql|int|string>, distinct: bool, distinctOn: list<Forrest79\PhPgSql\Db\Sql|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\Condition>, lateral-tables: array<string, string>, where: Forrest79\PhPgSql\Fluent\Condition|null, ...}, array{with: array{queries: array{}}} given.'
identifier: argument.type
count: 1
path: tests/Unit/FluentQueryTest.php
-
rawMessage: Cannot access offset 0 on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 8
path: tests/Unit/ParseDataTypeTest.php
-
rawMessage: Cannot access offset 1 on mixed.
identifier: offsetAccess.nonOffsetAccessible
count: 3
path: tests/Unit/ParseDataTypeTest.php
-
rawMessage: 'Cannot call method format() on mixed.'
identifier: method.nonObject
count: 17
path: tests/Unit/ParseDataTypeTest.php
-
rawMessage: 'AnonymousClass9e2a62bb2c94f025d33938f045f89554::__construct() does not call parent constructor from Forrest79\PhPgSql\Db\PreparedStatementHelper.'
identifier: constructor.missingParentCall
count: 1
path: tests/Unit/QueryTest.php
# === We know, that this can happen ===
-
rawMessage: Instanceof between BackedEnum and BackedEnum will always evaluate to true.
identifier: instanceof.alwaysTrue
count: 1
path: src/Fluent/Query.php
-
rawMessage: Result of && is always false.
identifier: booleanAnd.alwaysFalse
count: 1
path: src/Fluent/Query.php
-
rawMessage: 'Offset ''prefix''|''suffix'' on array{select: array<int|string, BackedEnum|Forrest79\PhPgSql\Db\Sql|int|string>, distinct: bool, distinctOn: list<Forrest79\PhPgSql\Db\Sql|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\Condition>, lateral-tables: array<string, string>, where: Forrest79\PhPgSql\Fluent\Condition|null, ...} on left side of ?? always exists and is not nullable.'
identifier: nullCoalesce.offset
count: 1
path: src/Fluent/QueryBuilder.php
-
rawMessage: 'Strict comparison using === between ''suffix'' and ''suffix'' will always evaluate to true.'
identifier: identical.alwaysTrue
count: 1
path: src/Fluent/QueryBuilder.php
-
rawMessage: Unreachable statement - code above always terminates.
identifier: deadCode.unreachable
count: 1
path: src/Fluent/QueryBuilder.php
# === We know, that this can't happen ===
-
rawMessage: 'Parameter #2 $rawValues of method Forrest79\PhPgSql\Db\RowFactory::create() expects array<string, string|null>, array<int|string, string|null> given.'
identifier: argument.type
count: 1
path: src/Db/Result.php
-
rawMessage: 'Call to function is_string() with string will always evaluate to true.'
identifier: function.alreadyNarrowedType
count: 3
path: src/Db/Row.php
-
rawMessage: 'Method Forrest79\PhPgSql\Db\RowIterator::current() should return Forrest79\PhPgSql\Db\Row but returns Forrest79\PhPgSql\Db\Row|null.'
identifier: return.type
count: 1
path: src/Db/RowIterator.php
-
rawMessage: 'Parameter #2 $expected of static method Forrest79\PhPgSql\Fluent\Exceptions\ConditionException::badParamsCount() expects int, int<0, max>|false given.'
identifier: argument.type
count: 1
path: src/Fluent/Condition.php
# === PHPStan imperfection ===
-
message: "#^Property Forrest79\\\\PhPgSql\\\\Fluent\\\\Query::\\$params \\(array\\{select: array\\<int\\|string, BackedEnum\\|Forrest79\\\\PhPgSql\\\\Db\\\\Sql\\|int\\|string\\>, distinct: bool, distinctOn: list\\<Forrest79\\\\PhPgSql\\\\Db\\\\Sql\\|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\\\\Condition\\>, lateral\\-tables: array\\<string, string\\>, where: Forrest79\\\\PhPgSql\\\\Fluent\\\\Condition\\|null, \\.\\.\\.\\}\\) does not accept .+\\.$#"
identifier: assign.propertyType
path: src/Fluent/Query.php
count: 8