Skip to content

Commit 67c5b98

Browse files
committed
Phpstan baselined at level 5 - All level 5 erros will be fixed prior to merge.
Signed-off-by: Joey Smith <jsmith@webinertia.net>
1 parent 961c682 commit 67c5b98

File tree

4 files changed

+250
-2
lines changed

4 files changed

+250
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
7373
"test-integration": "phpunit --colors=always --testsuite \"integration test\"",
7474
"static-analysis": "vendor/bin/phpstan analyse --memory-limit=256M",
75-
"sa-update-baseline": "vendor/bin/phpstan analyse --generate-baseline",
75+
"sa-generate-baseline": "vendor/bin/phpstan analyse --memory-limit=256M --generate-baseline",
7676
"upload-coverage": "coveralls -v"
7777
}
7878
}

phpstan-baseline.neon

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Variable \$aliasTo on left side of \?\?\= is never defined\.$#'
5+
identifier: nullCoalesce.variable
6+
count: 1
7+
path: src/Container/DriverInterfaceFactoryFactory.php
8+
9+
-
10+
message: '#^Cannot call static method createFromConfig\(\) on callable\.$#'
11+
identifier: staticMethod.nonObject
12+
count: 1
13+
path: src/Container/MysqliDriverFactory.php
14+
15+
-
16+
message: '#^Cannot call static method createFromConfig\(\) on callable\.$#'
17+
identifier: staticMethod.nonObject
18+
count: 1
19+
path: src/Container/PdoDriverFactory.php
20+
21+
-
22+
message: '#^Method PhpDb\\Adapter\\Profiler\\ProfilerInterface\:\:profilerFinish\(\) invoked with 1 parameter, 0 required\.$#'
23+
identifier: arguments.count
24+
count: 1
25+
path: src/Driver/Mysqli/Connection.php
26+
27+
-
28+
message: '#^PHPDoc type mysqli of property PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Connection\:\:\$resource is not covariant with PHPDoc type resource\|null of overridden property PhpDb\\Adapter\\Driver\\AbstractConnection\:\:\$resource\.$#'
29+
identifier: property.phpDocType
30+
count: 1
31+
path: src/Driver/Mysqli/Connection.php
32+
33+
-
34+
message: '#^Property PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Connection\:\:\$driver \(PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Mysqli\) does not accept PhpDb\\Adapter\\Driver\\DriverInterface\.$#'
35+
identifier: assign.propertyType
36+
count: 1
37+
path: src/Driver/Mysqli/Connection.php
38+
39+
-
40+
message: '#^Property PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Connection\:\:\$resource \(mysqli\) does not accept null\.$#'
41+
identifier: assign.propertyType
42+
count: 1
43+
path: src/Driver/Mysqli/Connection.php
44+
45+
-
46+
message: '#^Strict comparison using \!\=\= between null and null will always evaluate to false\.$#'
47+
identifier: notIdentical.alwaysFalse
48+
count: 1
49+
path: src/Driver/Mysqli/Connection.php
50+
51+
-
52+
message: '#^Variable \$names in PHPDoc tag @var does not match assigned variable \$findParameterValue\.$#'
53+
identifier: varTag.differentVariable
54+
count: 1
55+
path: src/Driver/Mysqli/Connection.php
56+
57+
-
58+
message: '#^Instanceof between PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Connection and PhpDb\\Adapter\\Driver\\DriverAwareInterface will always evaluate to true\.$#'
59+
identifier: instanceof.alwaysTrue
60+
count: 1
61+
path: src/Driver/Mysqli/Mysqli.php
62+
63+
-
64+
message: '#^Instanceof between PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Connection and PhpDb\\Adapter\\Profiler\\ProfilerAwareInterface will always evaluate to true\.$#'
65+
identifier: instanceof.alwaysTrue
66+
count: 1
67+
path: src/Driver/Mysqli/Mysqli.php
68+
69+
-
70+
message: '#^Instanceof between PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement and PhpDb\\Adapter\\Driver\\DriverAwareInterface will always evaluate to true\.$#'
71+
identifier: instanceof.alwaysTrue
72+
count: 1
73+
path: src/Driver/Mysqli/Mysqli.php
74+
75+
-
76+
message: '#^Instanceof between PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement and PhpDb\\Adapter\\Profiler\\ProfilerAwareInterface will always evaluate to true\.$#'
77+
identifier: instanceof.alwaysTrue
78+
count: 1
79+
path: src/Driver/Mysqli/Mysqli.php
80+
81+
-
82+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Mysqli\:\:getResultPrototype\(\) should return PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Result but returns PhpDb\\Adapter\\Driver\\ResultInterface\.$#'
83+
identifier: return.type
84+
count: 1
85+
path: src/Driver/Mysqli/Mysqli.php
86+
87+
-
88+
message: '#^Parameter \#1 \$resource \(mysqli\|mysqli_stmt\|PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\mysqli_result\) of method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Mysqli\:\:createResult\(\) should be compatible with parameter \$resource \(resource\) of method PhpDb\\Adapter\\Driver\\DriverInterface\:\:createResult\(\)$#'
89+
identifier: method.childParameterType
90+
count: 1
91+
path: src/Driver/Mysqli/Mysqli.php
92+
93+
-
94+
message: '#^Parameter \$resource of method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Mysqli\:\:createResult\(\) has invalid type PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\mysqli_result\.$#'
95+
identifier: class.notFound
96+
count: 1
97+
path: src/Driver/Mysqli/Mysqli.php
98+
99+
-
100+
message: '#^Instanceof between mysqli_stmt and mysqli_stmt will always evaluate to true\.$#'
101+
identifier: instanceof.alwaysTrue
102+
count: 2
103+
path: src/Driver/Mysqli/Result.php
104+
105+
-
106+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Result\:\:initialize\(\) has PhpDb\\Adapter\\Exception\\InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
107+
identifier: throws.unusedType
108+
count: 1
109+
path: src/Driver/Mysqli/Result.php
110+
111+
-
112+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Result\:\:isBuffered\(\) never returns null so it can be removed from the return type\.$#'
113+
identifier: return.unusedType
114+
count: 1
115+
path: src/Driver/Mysqli/Result.php
116+
117+
-
118+
message: '#^Result of && is always false\.$#'
119+
identifier: booleanAnd.alwaysFalse
120+
count: 1
121+
path: src/Driver/Mysqli/Result.php
122+
123+
-
124+
message: '#^Instanceof between PhpDb\\Adapter\\ParameterContainer and PhpDb\\Adapter\\ParameterContainer will always evaluate to true\.$#'
125+
identifier: instanceof.alwaysTrue
126+
count: 1
127+
path: src/Driver/Mysqli/Statement.php
128+
129+
-
130+
message: '#^Instanceof between mysqli_stmt and mysqli_stmt will always evaluate to true\.$#'
131+
identifier: instanceof.alwaysTrue
132+
count: 1
133+
path: src/Driver/Mysqli/Statement.php
134+
135+
-
136+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement\:\:execute\(\) never returns null so it can be removed from the return type\.$#'
137+
identifier: return.unusedType
138+
count: 1
139+
path: src/Driver/Mysqli/Statement.php
140+
141+
-
142+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement\:\:getParameterContainer\(\) never returns null so it can be removed from the return type\.$#'
143+
identifier: return.unusedType
144+
count: 1
145+
path: src/Driver/Mysqli/Statement.php
146+
147+
-
148+
message: '#^Method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement\:\:getSql\(\) never returns null so it can be removed from the return type\.$#'
149+
identifier: return.unusedType
150+
count: 1
151+
path: src/Driver/Mysqli/Statement.php
152+
153+
-
154+
message: '#^Property PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement\:\:\$driver \(PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Mysqli\) does not accept PhpDb\\Adapter\\Driver\\DriverInterface\.$#'
155+
identifier: assign.propertyType
156+
count: 1
157+
path: src/Driver/Mysqli/Statement.php
158+
159+
-
160+
message: '#^Return type \(mysqli_stmt\) of method PhpDb\\Adapter\\Mysql\\Driver\\Mysqli\\Statement\:\:getResource\(\) should be compatible with return type \(resource\) of method PhpDb\\Adapter\\Driver\\StatementInterface\:\:getResource\(\)$#'
161+
identifier: method.childReturnType
162+
count: 1
163+
path: src/Driver/Mysqli/Statement.php
164+
165+
-
166+
message: '#^Call to function is_string\(\) with string will always evaluate to true\.$#'
167+
identifier: function.alreadyNarrowedType
168+
count: 1
169+
path: src/Driver/Pdo/Connection.php
170+
171+
-
172+
message: '#^Parameter \#1 \$name \(string\) of method PhpDb\\Adapter\\Mysql\\Driver\\Pdo\\Connection\:\:getLastGeneratedValue\(\) should be compatible with parameter \$name \(null\) of method PhpDb\\Adapter\\Driver\\ConnectionInterface\:\:getLastGeneratedValue\(\)$#'
173+
identifier: method.childParameterType
174+
count: 2
175+
path: src/Driver/Pdo/Connection.php
176+
177+
-
178+
message: '#^Parameter \#2 \$parameters of class PhpDb\\Adapter\\Exception\\InvalidConnectionParametersException constructor expects int, array given\.$#'
179+
identifier: argument.type
180+
count: 2
181+
path: src/Driver/Pdo/Connection.php
182+
183+
-
184+
message: '#^Parameter \#1 \$resource \(PDOStatement\) of method PhpDb\\Adapter\\Mysql\\Driver\\Pdo\\Pdo\:\:createResult\(\) should be compatible with parameter \$resource \(resource\) of method PhpDb\\Adapter\\Driver\\DriverInterface\:\:createResult\(\)$#'
185+
identifier: method.childParameterType
186+
count: 3
187+
path: src/Driver/Pdo/Pdo.php
188+
189+
-
190+
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, array\<int, array\<int, string\>\> given\.$#'
191+
identifier: argument.type
192+
count: 2
193+
path: src/Metadata/Source/MysqlMetadata.php
194+
195+
-
196+
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, array\<int, list\<string\>\> given\.$#'
197+
identifier: argument.type
198+
count: 4
199+
path: src/Metadata/Source/MysqlMetadata.php
200+
201+
-
202+
message: '#^Variable \$isFK might not be defined\.$#'
203+
identifier: variable.undefined
204+
count: 1
205+
path: src/Metadata/Source/MysqlMetadata.php
206+
207+
-
208+
message: '#^Variable \$name might not be defined\.$#'
209+
identifier: variable.undefined
210+
count: 2
211+
path: src/Metadata/Source/MysqlMetadata.php
212+
213+
-
214+
message: '#^Method PhpDb\\Adapter\\Mysql\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator\:\:processColumns\(\) never returns null so it can be removed from the return type\.$#'
215+
identifier: return.unusedType
216+
count: 1
217+
path: src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php
218+
219+
-
220+
message: '#^Method PhpDb\\Adapter\\Mysql\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator\:\:processColumns\(\) should return array\<array\<string\>\>\|null but empty return statement found\.$#'
221+
identifier: return.empty
222+
count: 1
223+
path: src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php
224+
225+
-
226+
message: '#^Method PhpDb\\Adapter\\Mysql\\Sql\\Platform\\Mysql\\SelectDecorator\:\:processLimit\(\) should return array\<string\>\|null but returns array\<int, int\>\.$#'
227+
identifier: return.type
228+
count: 1
229+
path: src/Sql/Platform/Mysql/SelectDecorator.php
230+
231+
-
232+
message: '#^Offset ''paramPrefix'' does not exist on string\.$#'
233+
identifier: offsetAccess.notFound
234+
count: 2
235+
path: src/Sql/Platform/Mysql/SelectDecorator.php
236+
237+
-
238+
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertIsInt\(\) with int will always evaluate to true\.$#'
239+
identifier: staticMethod.alreadyNarrowedType
240+
count: 1
241+
path: test/integration/Driver/Pdo/ConnectionTest.php
242+
243+
-
244+
message: '#^Method PhpDbIntegrationTest\\Adapter\\Mysql\\Driver\\Pdo\\TableGatewayTest\:\:testInsertWithExtendedCharsetFieldName\(\) never returns string so it can be removed from the return type\.$#'
245+
identifier: return.unusedType
246+
count: 1
247+
path: test/integration/Driver/Pdo/TableGatewayTest.php

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
includes:
2+
- phpstan-baseline.neon
13
parameters:
24
level: 5
35
paths:

test/integration/Container/TestAsset/SetupTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Laminas\ServiceManager\ServiceManager;
88
use Laminas\Stdlib\ArrayUtils;
9-
use PhpDb\Adapter\Adapter;
109
use PhpDb\Adapter\AdapterInterface;
1110
use PhpDb\Adapter\Driver\DriverInterface;
1211
use PhpDb\Adapter\Mysql\ConfigProvider;

0 commit comments

Comments
 (0)