-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathphpstan.neon.dist
107 lines (93 loc) · 4.97 KB
/
phpstan.neon.dist
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
parameters:
level: 8
phpVersion: 80402
paths:
- src
- static-analysis
- tests
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- identifier: missingType.generics
# https://github.com/phpstan/phpstan-strict-rules/issues/103
-
message: '~^Construct empty\(\) is not allowed. Use more strict comparison\.~'
paths:
- src/Connections/PrimaryReadReplicaConnection.php
- src/Driver/*/Driver.php
- src/Driver/AbstractOracleDriver/EasyConnectString.php
- src/Platforms/*Platform.php
- src/Schema/*SchemaManager.php
- tests/TestUtil.php
# In some namespaces, we use array<string,mixed>, some elements of which are actually boolean
-
message: '~^Only booleans are allowed in .*, mixed given~'
paths:
- src/Platforms/*Platform.php
- src/Schema/*SchemaManager.php
# Some APIs use variable method calls internally
-
message: '~^Variable method call on .*~'
paths:
- src/Schema/Column.php
# TODO: remove this once the support for PHP 7 is dropped
-
message: '~^Strict comparison using !== between int and false will always evaluate to true\.$~'
paths:
- src/Driver/OCI8/Result.php
-
message: '~^Unreachable statement - code above always terminates\.$~'
paths:
- src/Driver/OCI8/Result.php
# https://github.com/phpstan/phpstan/issues/4679
-
message: '~^Cannot call method writeTemporary\(\) on OCILob\|null\.$~'
paths:
- src/Driver/OCI8/Statement.php
# We're testing with invalid input.
-
message: '~array{driver: ''invalid_driver''} given\.$~'
path: tests/DriverManagerTest.php
-
message: '~array{driver: ''pdo_sqlite'', memory: true, wrapperClass: ''stdClass''} given\.$~'
path: tests/DriverManagerTest.php
-
message: '~array{driverClass: ''stdClass''} given\.$~'
path: tests/DriverManagerTest.php
-
message: '~^Parameter #1 \$driverOptions of method Doctrine\\DBAL\\Tests\\Functional\\Driver\\Mysqli\\ConnectionTest\:\:getConnection\(\) expects array<string, mixed>, .* given\.$~'
path: tests/Functional/Driver/Mysqli/ConnectionTest.php
-
message: '~^Parameter #1 \$params of method Doctrine\\DBAL\\Driver\:\:connect\(\) expects array~'
path: tests/Driver/PDO/*/DriverTest.php
# There is no way to make this assertion in the code,
# and the API doesn't support parametrization of returned column types.
-
message: '~^Method Doctrine\\DBAL\\Schema\\PostgreSQLSchemaManager::fetchTableOptionsByTable\(\) should return array<string, array<string, mixed>> but returns array<int\|string, array<string, mixed>>\.$~'
paths:
- src/Schema/PostgreSQLSchemaManager.php
# We don't need to declare the return type *that* fine-grained.
- '~^Method Doctrine\\DBAL\\Driver\\PDO\\Statement\:\:convertParamType\(\) never returns \d+ so it can be removed from the return type\.$~'
# PHPStan does not understand the array shapes returned by pg_fetch_*() methods.
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapAssociativeRow\(\) expects array<string, string\|null>, array<int\|string, string\|null> given\.$~'
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects list<string\|null>, .* given\.$~'
# Required for Psalm compatibility
- '~^Property Doctrine\\DBAL\\Tests\\Types\\BaseDateTypeTestCase\:\:\$currentTimezone \(non-empty-string\) does not accept string\.$~'
# The @throws annotations are part of a contract. Even if the default implementation doen't throw those
# exceptions, the child implementations might do so.
-
identifier: throws.unusedType
path: src/Types/Type.php
# We don't narrow the return type of lastInsertId() yet.
- '/^Method Doctrine\\DBAL\\Driver\\.+\\Connection\:\:lastInsertId\(\) never returns (int|false) so it can be removed from the return type\.$/'
# Type check for legacy implementations of the Result interface
# TODO: remove in 5.0.0
- '~^Call to function method_exists\(\) with Doctrine\\DBAL\\Driver\\Result and ''getColumnName'' will always evaluate to true\.$~'
# TODO: Review these errors and fix them.
- identifier: phpunit.assertEquals
includes:
- phpstan-baseline.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon