forked from diablomedia/doctrine1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpstan.neon
399 lines (392 loc) · 37.2 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
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
parameters:
bootstrap: phpstan-bootstrap.php
ignoreErrors:
#########
# Level 0
#########
# These two methods don't exist (anywhere in Doctrine), this sequence adapter is probably broken
- '#Call to an undefined method Doctrine_Sequence_Db2::_connect\(\)\.#'
- '#Call to an undefined method Doctrine_Sequence_Db2::lastSequenceId\(\)\.#'
# This method only exists on Doctrine_Query_Condition
- '#Call to an undefined method Doctrine_Query_Set::parseLiteralValue\(\)\.#'
# These methods are defined on Doctrine_Query, and probably should be made abstract in Doctrine_Query_Abstract,
# but that would break anything extending Doctrine_Query_Abstract that doesn't define the method (like Doctrine_RawSql)
- '#Call to an undefined method Doctrine_Query_Abstract::isSubquery\(\)\.#'
- '#Call to an undefined method Doctrine_Query_Abstract::copy\(\)\.#'
# Similar to above, this is defined in all sub-classes of Doctrine_Query_Condition, but not in the abstract class
# itself, so should be an abstract method, but that would break any code outside of Doctrine that extends this
- '#Call to an undefined method Doctrine_Query_Condition::load\(\)\.#'
# Both Doctrine_Expression_Mysql and Doctrine_Expression_Pgsql call this, but doesn't seem to exist anywhere in
# the Doctrine codebase. Both methods it appears in are marked as "experimental"
- '#Call to an undefined method Doctrine_Expression_.+sql::patternEscapeString\(\)\.#'
# These methods do not exist anywhere in Doctrine
- '#Call to an undefined method Doctrine_Search_Indexer_Dir::indexFile\(\)\.#'
- '#Call to an undefined method Doctrine_Transaction::addDelete\(\)\.#'
# In Doctrine_Cli_Formatter:81, this seems like a bug, the format probably has a type-o, but not sure what the intent was
# php > echo sprintf(">> %-$9s %s", 'testing', 'another test');
# >> 9s another test
- '#Call to sprintf contains 1 placeholder, 2 values given\.#'
# This is probably intentional since it's a mock and doesn't want to have the same functionality as a true connection
- '#Doctrine_Connection_Mock::__construct\(\) does not call parent constructor from Doctrine_Connection\.#'
- '#Constructor of class Doctrine_Connection_Mock has an unused parameter \$.+\.#'
# Not really harmful or anything, none of the classes that ultimately extend Doctrine_Connection have either param
# in their signature. Even other extending classes shouldn't be affected if removed from signature, but just ignoring
- '#Constructor of class Doctrine_Connection has an unused parameter \$user\.#'
- '#Constructor of class Doctrine_Connection has an unused parameter \$pass\.#'
# These aren't implemented yet (throw an exception stating such)
- '#Constructor of class Doctrine_Node_MaterializedPath_.+Iterator has an unused parameter \$(node|opts)\.#'
#########
# Level 1
#########
# This isset check could probably be removed (Doctrine_I18n:124) because the method that is called to set `$others` already does an
# isset check on the value it returns and throws an exception if it's not set
- '#Variable \$others in isset\(\) always exists and is not nullable\.#'
# The block for this is a bit confusing (Doctrine_Connection_UnitOfWork:831), but $rootRecord is set on the first
# iteration of the foreach loop, and then referenced in each subsequent iteration. Assuming this is intentional
- '#Variable \$rootRecord might not be defined\.#'
# Not really sure what a satisfactory default value for $oci_length should be, seems that it should maybe be set to the $length parameter
# but not certain (Doctrine_Adapter_Statement_Oracle:175)
- '#Variable \$oci_length might not be defined\.#'
# This one would require some testing to see if it can be predefined, as it's predefined as "null" in a specific case, but undefined otherwise
# (though is_null will return true for undefined variables (but throws a notice), so perhaps it doesn't matter if it's set to null.)
# Doctrine_Hydrator_Graph:131
- '#Variable \$activeRootIdentifier might not be defined\.#'
# These four are only used if the $autoincrement var is set to "true", and if it's set to "true", they get defined.
# In Doctrine_Migration_Base:278
- '#Variable \$autoincrementColumn might not be defined\.#'
- '#Variable \$autoincrementType might not be defined\.#'
- '#Variable \$autoincrementLength might not be defined\.#'
- '#Variable \$autoincrementOptions might not be defined\.#'
# These three happen several times in Doctrine_Node_NestedSet and each are structured the same way. The docblocks say something to the
# effect of "gets record of ... or empty record". The way the code is now, they return null (undefined variable) if the record doesn't exist,
# not an empty record. Could return an empty Doctrine_Record here, but not sure how that would affect behavior.
- '#Variable \$sibling might not be defined\.#'
- '#Variable \$child might not be defined\.#'
# (this one belongs to the previous group as well, not easy to tell phpstan to ignore specific errors in specific files)
# This one shows up in both Doctrine_Query and Doctrine_RawSql and is pretty much the same situation. I'm not sure what a good default
# for parent should be (though in this case it's probably being passed as null in all situations since it could be undefined)
- '#Variable \$parent might not be defined\.#'
# This one refers specifically to Doctrine_Connection:1040. In some cases $stmt is defined in an if block with no else, so would probably be safe
# to set to null in this case
- '#Variable \$stmt might not be defined\.#'
# Similar to the one above in Doctrine_Connection:1075
- '#Variable \$count might not be defined\.#'
# Doctrine_Relation_Parser:512, $table must always be set since nobody that has cared has complained about this, but seems like it should
# either be set to an initial value, or have an isset() check around it. There's a comment questioning if it should be $table or $this->table
- '#Variable \$table might not be defined\.#'
# Doctrine_Query_Check:155, this one doesn't really matter much, as it'll just return null/undefined if it doesn't get set, could initialize as null
# perhaps to make phpstan happy
- '#Variable \$func might not be defined\.#'
# In Doctrine_Table:506, seems to change $this->_identifier from an array to the last value of that array, intentional? $pk won't be defined if
# $this->_identifier is empty
- '#Variable \$pk might not be defined\.#'
# Doctrine_Query:981|988|990|1195, not sure what good defaults should be (assuming blank string for most of these is what's happening now)
- '#Variable \$tableAlias might not be defined\.#'
- '#Variable \$componentAlias might not be defined\.#'
- '#Variable \$queryComponentsBefore might not be defined\.#'
#########
# Level 2
#########
# This exists on all of the Validator classes that extend Doctrine_Validator_Driver, but not the Driver class itself. Should probably be
# turned into an abstract class with the Validate method defined as abstract, but would break API
- '#Call to an undefined method Doctrine_Validator_Driver::validate\(\)\.#'
# From Doctrine_IntegrityMapper, this method does not exist, and Doctrine_Manager doesn't appear to have any __call magic method implemented
# (nor its parents). This code isn't currently touched by tests, assuming it's broken.
# (https://codecov.io/gh/diablomedia/doctrine1/src/master/lib/Doctrine/IntegrityMapper.php#L56)
- '#Call to an undefined method Doctrine_Manager::getDeleteActions\(\)\.#'
# In Doctrine_Collection_Iterator_Expandable:40, no static references to a function named "expand" in the codebase, and don't see any __call methods
# on Doctrine_Collection or its parents.
- '#Call to an undefined method Doctrine_Collection::expand\(\)\.#'
# In Doctrine_Export:744, all extending classes of Doctrine_DataDict implement this method, but Doctrine_DataDict does not (should probably be added
# as an abstract definition, which does break public API)
- '#Call to an undefined method Doctrine_DataDict::getNativeDeclaration\(\)\.#'
# In Doctrine_Import_Sqlite:78, this function only seems to exist on the Doctrine_Formatter class, and I don't see any path from Doctrine_Connection
# to Doctrine_Formatter that would work here (no __call in Doctrine_Connection), not covered by tests
- '#Call to an undefined method Doctrine_Connection::fixSequenceName\(\)\.#'
# In Doctrine_Export_Mssql:346|375, similar to above, method exists on Doctrine_Formatter, not Doctrine_Connection (or any subclasses of)
# not covered by tests, probably broken.
- '#Call to an undefined method Doctrine_Connection::getSequenceName\(\)\.#'
# In Doctrine_Template_Listener_Sluggable:108, this is wrapped by a function_exists call, and looks like it's built so that a Doctrine_Record
# object can define that method to implement its own version of slug generation if desired by the implementer.
- '#Call to an undefined method Doctrine_Record::getUniqueSlug\(\)\.#'
# In Doctrine_Query_Orderby:107|162, these are both wrapped by a method_exists call, and this method is only defined on the
# Doctrine_Connection_Mssql class, should be safe.
- '#Call to an undefined method Doctrine_Connection::modifyOrderByColumn\(\)\.#'
# Both of these are in the "Experimental" Doctrine_Expression_Mysql|Pgsql blocks, not covered by tests. The methods exist on
# Doctrine_Formatter, not Doctrine_Connection
- '#Call to an undefined method Doctrine_Connection::escapePattern\(\)\.#'
- '#Call to an undefined method Doctrine_Connection::escape\(\)\.#'
# In Doctrine_Query_Abstract:2099, most of the classes that extend Doctrine_Query_Part implement this parse method but the base
# class does not. Should probably be made into an abstract method definition on that class (but would break API)
- '#Call to an undefined method Doctrine_Query_Part::parse\(\)\.#'
#########
# Level 3
#########
# This one calls execute with the HYDRATE_ARRAY constant, which should return an array
- '#Method Doctrine_Query::fetchArray\(\) should return array but returns array\|Doctrine_Collection\.#'
# This one does not allow specifying the hydration mode, so should default to Doctrine_Collection (record hydration)
- '#Method Doctrine_IntegrityMapper::buildIntegrityRelationQuery\(\) should return Doctrine_Collection but returns array\|Doctrine_Collection\.#'
- '#Method Doctrine_Relation_Association_Self::fetchRelatedFor\(\) should return Doctrine_Collection but returns array\|Doctrine_Collection\.#'
# Not clear why phpstan complains on this one. If $collection is_scalar, it won't be a Doctrine_Collection
- '#Method Doctrine_Query::fetchOne\(\) should return array\|Doctrine_Record\|false but returns array\|Doctrine_Collection\.#'
# $mutator can be any string really, and there's no contract that mutator functions should return $this
- '#Method Doctrine_Record::set\(\) should return \$this but returns \$this->{\$mutator}\(\$value, \$load, \$fieldName\)\.#'
# Filters should return the record object they're given (which is $this)
- '#Method Doctrine_Record::_set\(\) should return \$this but returns \$value\.#'
#########
# Level 4
#########
# Most of these casts would be unnecessary if scalar type hints were used on these function parameters, probably worth looking
# into later (can't do non-array type hints until PHP 7.0 anyhow)
- '#Casting to array something that.s already array\.#'
- '#Casting to int something that.s already int\.#'
- '#Casting to string something that.s already string\.#'
- '#Casting to bool something that.s already bool\.#'
# This one only happens in Doctrine_Hydrator:122 as of this writing, in this case it seems unnecessary because as far as I can
# tell, the value will always be a string. However, it's possible that maybe in some extending classes this ends up being an
# object, so leaving as-is.
- '#Call to function is_object\(\) will always evaluate to false\.#'
# Most of these checks are validating the argument coming into the function to be sure it isn't "null"/unset. I don't want to add
# "null" to the allowed types for these, as usually these will just coerce the value or set some default when "null" is passed (sometimes
# an exception is thrown)
- '#Call to function is_null\(\) will always evaluate to false\.#'
- '#Strict comparison using (!|=)== between (array\|bool\|float\|int\|string|string|array|Doctrine_Record_Generator|array\|Doctrine_Collection|int|bool\|Doctrine_Cache_Interface|int\|string) and null will always evaluate to (true|false)\.#'
# These are done for similar reasons, but comparing to false. These are probably rarely needed, since a ture "false" isn't returned by the
# methods setting these values
- '#Strict comparison using !== between (Doctrine_Cache_Interface\|true|string) and false will always evaluate to true\.#'
#########
# Level 5
#########
# This should always be an array in this case because the HYDRATE_ARRAY hydration method is used.
- '#Parameter \#1 \$data of method Doctrine_Record::hydrate\(\) expects array, array\|Doctrine_Collection\|Doctrine_Record given\.#'
# In Doctrine_Query:2146, the $params var should be an array here as the convertBooleans path will only return an int if
# the passed in value is a bool, which it shouldn't be here, since $params starts as an array in the function arguments
- '#Parameter \#1 \$params of method Doctrine_Query_Abstract::getResultCacheHash\(\) expects array, array\|int given\.#'
# And 968|981
- '#Parameter \#1 \$params of method Doctrine_Query_Abstract::getSqlQuery\(\) expects array, array\|int given\.#'
# And Doctrine_Query:2151|2157
- '#Parameter \#2 \$params of method Doctrine_Connection::fetchAll\(\) expects array, array\|int given\.#'
# These methods are defined on Doctrine_Record but not on Doctrine_Record_Abstract (they should be defined as abstract methods,
# but that would break public API). These came up now because I changed the doc block for the _invoker property (and related methods)
# in Doctrine_Template to match the PHP typehint of the setInvoker method.
- '#Call to an undefined method Doctrine_Record_Abstract::delete\(\)\.#'
# In Doctrine_Record:1973, false should be checked for, as it's a valid return from toArray
- '#Parameter \#1 \$array of method Doctrine_Record::fromArray\(\) expects array, array\|Doctrine_Record\|false given\.#'
# Similar to above, just different method
- '#Parameter \#1 \$array of static method Doctrine_Parser::dump\(\) expects array, array\|false given\.#'
# Also appears in Doctrine_Collection:847
- '#Parameter \#1 \$path of static method Doctrine_Parser::load\(\) expects string, array\|string given\.#'
# getIdentifier can return an array for multi-column primary keys, the whereIn stuff in Doctrine_Query will not deal with that well
- '#Parameter \#1 \$expr of method Doctrine_Query_Abstract::whereIn\(\) expects string, array\|string given\.#'
# Most likely this oobject is a Doctrine_Record, but the typehints don't guarantee that
- '#Parameter \#1 \$record of method Doctrine_AuditLog::getVersion\(\) expects Doctrine_Record, Doctrine_Record_Abstract given\.#'
# This is in a conditional that should prevent it from passing non-array data, I think
- '#Parameter \#1 \$array of method Doctrine_Collection::fromArray\(\) expects array, array\|string given\.#'
# var can be false, param not setup to accept that (would be checking for an array key with a value of false)
- '#Parameter \#1 \$fieldName of method Doctrine_Table::hasField\(\) expects string, false\|string given\.#'
# In Doctrine_Data_Export:120, I couldn't find any cases where $directory might be an array, so didn't change the docblock to allow it
- '#Call to function is_array\(\) will always evaluate to false\.#'
# null could be passed in this case, would need to check for that in Doctrine_Event
- '#Parameter \#4 \$params of class Doctrine_Event constructor expects array, array\|null given\.#'
# Both of these could come in as null, would need to check for that
- '#Parameter \#1 \$queryComponents of method Doctrine_Hydrator_Abstract::setQueryComponents\(\) expects array, array\|null given\.#'
- '#Parameter \#1 \$tableAliases of method Doctrine_Hydrator_Abstract::setTableAliases\(\) expects array, array\|null given\.#'
#########
# Level 6
#########
# For all of these, there is an "isTree" check right before the method call on getTree() that would prevent it from being false
# Doctrine_Table:281
- '#Cannot call method setUp\(\) on Doctrine_Tree\|false\.#'
# Doctrine_Table:406
- '#Cannot call method setTableDefinition\(\) on Doctrine_Tree\|false\.#'
# These all happen in Doctrine_Node_NestedSet, it seems that it's pretty much assumed that the $_tree property will never
# be false, as there are no "hasTree" checks done here. Perhaps within the NestedSet objects it's not possible for $_tree
# to ever be false.
- '#Cannot call method getBaseAlias\(\) on Doctrine_Tree_NestedSet\|false\.#'
- '#Cannot call method getBaseQuery\(\) on Doctrine_Tree_NestedSet\|false\.#'
- '#Cannot call method returnQueryWithRootId\(\) on Doctrine_Tree_NestedSet\|false\.#'
- '#Cannot call method getBaseComponent\(\) on Doctrine_Tree_NestedSet\|false\.#'
- '#Cannot call method getAttribute\(\) on Doctrine_Tree_NestedSet\|false\.#'
# These are similar to the above ones on Doctrine_Tree. The getNode method of Doctrine_Record may return false if the Table
# object isn't a tree. These calls all happen in the Doctrine_Node_NestedSet class, assuming these won't be reached if the
# Table isn't a tree.
- '#Cannot call method getChildren\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method isRoot\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method getLeftValue\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method getRightValue\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method getRootValue\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method getLevel\(\) on Doctrine_Node\|false\.#'
- '#Cannot call method insertAsLastChildOf\(\) on Doctrine_Node\|false\.#'
# Similar to above, also in NestedSet related code, Doctrine_Tree_NestedSet:101
- '#Cannot call method setRootValue\(\) on Doctrine_Node\|false\.#'
# setLevel method does not exist, perhaps supposed to be updateLevel
- '#Call to an undefined method Doctrine_Node_NestedSet::setLevel\(\)\.#'
# This could be false if the value of $pk isn't a valid column name, so should be checked before looping, in Doctrine_Table:484
- '#Argument of an invalid type array\|false supplied for foreach, only iterables are supported\.#'
# Both of these don't specify a hydration mode, so a Doctrine_Collection should be returned by default, not an array
# Doctrine_Template_Geographical:114
- '#Cannot call method getFirst\(\) on array\|Doctrine_Collection\.#'
# Doctrine_Data_Export:91
- '#Cannot call method count\(\) on array\|Doctrine_Collection\.#'
# In Doctrine_Export_Pgsql:284, the type of $sql here could be a boolean (true) if the $check parameter is "true", this should
# probably be checked before looping (perhaps if $check === true, it just returns $sql?)
- '#Argument of an invalid type array\|true supplied for foreach, only iterables are supported\.#'
# This is mainly harmless, but the isset here could probably be removed. In Doctrine_Relation_Parser:225
- '#Variable \$rel in isset\(\) always exists and is not nullable\.#'
# This might be a reflection issue. The php.net manual shows this function as "experimental", but does show that it
# exists: http://php.net/manual/en/pdo.sqlitecreatefunction.php
# When I use the "--rf" option to see what PHP reports as the signature, I get "Exception: Method PDO::sqliteCreateFunction() does not exist"
# It does not show up in the "php --rc PDO" output either.
- '#Call to an undefined method PDO::sqliteCreateFunction\(\)\.#'
# This one is kind of silly, since it would require that somebody pass in "false" (bool value) for the $stmt parameter (not null, or string,
# or anything else, specifically the boolean false). Doctrine_Connection_Statement:58
- '#Strict comparison using === between Doctrine_Adapter_Statement_Interface\|PDOStatement and false will always evaluate to false\.#'
# These all happen in Doctrine_Template_Listener_SoftDelete, they're all called on the result of Doctrine_Event:getQuery which
# is marked as being either a string or Doctrine_Query. I have searched the codebase and do find instances where this would be
# either a string or Doctrine_Query_Abstract, so these calls are valid but are making an assumption that they're working on an object
# (which may be valid in this case, perhaps the Event passed to these listeners will always contain a query object, not a string)
# Happens in Doctrine_Template_Listener_Timestampable as well.
- '#Cannot call method contains\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method from\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method set\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method addWhere\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method getConnection\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method isSubquery\(\) on Doctrine_Query\|string\.#'
- '#Cannot call method addPendingJoinCondition\(\) on Doctrine_Query\|string\.#'
# In Doctrine_Connection_Statement:240 the default for the "$params" parameter should probably be changed to an empty array instead
# of null, there's also a truthy check on the param a bit later that would need to be modified to check if $params is empty
- '#Argument of an invalid type array\|null supplied for foreach, only iterables are supported\.#'
# The Overloadable interface doesn't explicitly define these methods, but it does implement __call, so it most likely would accept them
# if it was the type of object passed in
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postConnect\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postDelete\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postError\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postSerialize\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postUnserialize\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::postValidate\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preConnect\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preDelete\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preError\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preSerialize\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preUnserialize\(\)\.#'
- '#Call to an undefined method Doctrine_EventListener_Interface\|Doctrine_Overloadable::preValidate\(\)\.#'
# Not sure why phpstan complains about this one, the property in question ($_queryCache) could be false, but perhaps it's because
# the same check is done earlier in the flow. There's a comment above this call though that a function call earlier may
# have changed the value of the property, which is why it's being tested again.
# In Doctrine_Query_Abstract:974
- '#Strict comparison using !== between Doctrine_Cache_Interface\|true\|null and false will always evaluate to true\.#'
# I think overall this would need to be re-structured somehow in Doctrine. Currently Doctrine_Query_Abstract::__construct accepts
# a Doctrine_Hydrator_Abstract object (enforced via PHP typehint) as an optional parameter. If it's not set (is set to null)
# then the internal $_hydrator property is set to a new Doctrine_Hydrator object. Doctrine_Hydrator DOES NOT extend Doctrine_Hydrator_Abstract
# so they're not really the same thing. These methods are not found on Doctrine_Hydrate_Abstract (or any of its sub-classes), only
# on Doctrine_Hydrate. So it seems that if a custom hydrator was set on the Query object, it wouldn't work in places where
# these methods are called (unless implemented in the class itself, but there's no contract for that, so user may not know it doesn't
# work until runtime)
- '#Call to an undefined method Doctrine_Hydrator\|Doctrine_Hydrator_Abstract::getHydrationMode\(\)\.#'
- '#Call to an undefined method Doctrine_Hydrator\|Doctrine_Hydrator_Abstract::getHydratorDriverClassName\(\)\.#'
- '#Call to an undefined method Doctrine_Hydrator\|Doctrine_Hydrator_Abstract::getHydratorDriver\(\)\.#'
# These all have checks in place before they're called to make sure the object is not Doctrine_Null, in Doctrine_Record:1609|1610|1617
- '#Call to an undefined method Doctrine_Null\|Doctrine_Record::getTable\(\)\.#'
- '#Call to an undefined method Doctrine_Null\|Doctrine_Record::rawGet\(\)\.#'
- '#Call to an undefined method Doctrine_Null\|Doctrine_Record::set\(\)\.#'
# This one could send an int in a particular case where a different class property is set to a certain value, it must not be doing that
- '#Parameter \#1 \$stmt of method Doctrine_Hydrator::hydrateResultSet\(\) expects Doctrine_Adapter_Statement_Interface\|PDOStatement, Doctrine_Adapter_Statement_Interface\|int\|PDOStatement given\.#'
# The Memcache::getExtendedStats() may return false, should probably modify these foreach loops to check for that before looping
# Doctrine/Cache/Memcache.php:137|141
- '#Argument of an invalid type array|bool supplied for foreach, only iterables are supported.#'
# There is a method_exists check before this call, perhaps a migration can be Doctrine_Migration here, which does have this
# method, Doctrine_Migration_Base does not (which is what the migration classes are supposed to extend)
- '#Call to an undefined method Doctrine_Migration_Base::migrate\(\)\.#'
#########
# Level 7
#########
# The default value for this parameter should probably be changed to an empty array rather than null
# Called from Doctrine_Pager:504
- '#Parameter \#1 \$params of method Doctrine_Pager::setCountQueryParams\(\) expects array, array\|null given\.#'
# I don't think $to can actually be null when it's returned in this method, there's a check earlier if it is null that will
# change it to be the "latest version" which is always an int. That check is in a try/catch, so perhaps that's why phpstan doesn't see it
# Doctrine_Migration:347|352
- '#Method Doctrine_Migration::migrate\(\) should return false\|int but returns int\|null\.#'
# Also related, Doctrine_Migration:351
- '#Parameter \#1 \$number of method Doctrine_Migration::setCurrentVersion\(\) expects int, int\|null given\.#'
# The $parent var could be null, but emitAddChild shouldn't accept that, as it calls strtolower on it directly. Probably need to cast or check for null
# in the caller. Doctrine_Import_Builder:805|815|825
- '#Parameter \#2 \$parent of method Doctrine_Import_Builder::emitAddChild\(\) expects string, string\|null given\.#'
# If "free" is called on Doctrine_Collection then the reference property gets set to null. So, technically, if these code paths
# are hit after free is called, these could return null instead of a Doctrine_Record. Not sure if it's possible to get this far in
# that case though. Doctrine_Collection:363|454
- '#Calling method get\(\) on possibly null value of type Doctrine_Record\|null\.#'
# The result of getListener in Doctrine_Configurable can be null, so these are valid complaints. Code should be modified to expect that.
- '#Calling method postConnect\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method postDelete\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method postError\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method postSerialize\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method postUnserialize\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method postValidate\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preConnect\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preDelete\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preError\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preSerialize\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preUnserialize\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
- '#Calling method preValidate\(\) on possibly null value of type Doctrine_EventListener_Interface\|Doctrine_Overloadable\|null\.#'
# In the constructor of Doctrine_Connection_Mssql, the optional parameter $originQuery is never checked if it's indeed a Doctrine_Query object
# or null before these methods are called.
- '#Calling method getDqlPart\(\) on possibly null value of type Doctrine_Query\|null\.#'
- '#Calling method getExpressionOwner\(\) on possibly null value of type Doctrine_Query\|null\.#'
- '#Calling method getQueryComponent\(\) on possibly null value of type Doctrine_Query\|null\.#'
- '#Calling method getSqlQueryPart\(\) on possibly null value of type Doctrine_Query\|null\.#'
- '#Calling method getSqlTableAlias\(\) on possibly null value of type Doctrine_Query\|null\.#'
# These listeners don't check if the query object returned from getQuery is actually a null value (it could be since it's allowed
# on the Doctrine_Event constructor)
- '#Calling method addPendingJoinCondition\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method addWhere\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method contains\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method from\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method getConnection\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method isSubquery\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
- '#Calling method set\(\) on possibly null value of type Doctrine_Query\|string\|null\.#'
# Not sure that the invoker will ever be null when tasks are called
- '#Calling method getConfig\(\) on possibly null value of type Doctrine_Cli\|null\.#'
# These are optional parameters in Doctrine_Connection_Statement::fetch, maybe should be cast to ints, or not set on the event if null?
- '#Property Doctrine_Event::\$cursorOffset \(int\) does not accept int\|null\.#'
- '#Property Doctrine_Event::\$columnIndex \(int\) does not accept int\|null\.#'
# Doctrine_Lib::arrayDeepMerge only returns false if called with no parameters
- '#Property Doctrine_Record_Listener_Chain::\$_options \(array\) does not accept array\|false\.#'
- '#Property Doctrine_Record_Listener::\$_options \(array\) does not accept array\|false\.#'
- '#Property Doctrine_AuditLog::\$_options \(array\) does not accept array\|false\.#'
- '#Property Doctrine_Template::\$_options \(array\) does not accept array\|false\.#'
- '#Property Doctrine_I18n::\$_options \(array\) does not accept array\|false\.#'
- '#Property Doctrine_Search::\$_options \(array\) does not accept array\|false\.#'
# Default value on the $notification parameter should probably be changed to an empty string instead of null (Doctrine_Cli_Formatter is set that way)
# in Doctrine_Cli:406
- '#Parameter \#1 \$text of method Doctrine_Cli_Formatter::format\(\) expects string, string\|null given\.#'
# Also should probably be changed to an empty string instead of null, Doctrine_Adapter_Mock:75
- '#Property Doctrine_Adapter_Mock::\$_name \(string\) does not accept string\|null\.#'
# The Doctrine_Record::state method will return an int if it's not given any parameters ($state param == null), otherwise it returns nothing (void)
# I checked that in all of the cases that phpstan complains about this method and returns from it, that they're being used properly (assigning
# a value when no params are passed, not expecting a value when a param is passed)
- '#Parameter \#1 \$state of method Doctrine_Record::state\(\) expects int\|string\|null, int\|void given\.#'
- '#Parameter \#1 \$state of static method Doctrine_Lib::getRecordStateAsString\(\) expects int, int\|void given\.#'
# Probably change the else condition of the ternary here to an empty string instead of null, Doctrine_Query:1043
- '#Parameter \#1 \$alias of method Doctrine_Query::_processPendingJoinConditions\(\) expects string, string\|null given\.#'
# Same with this one, default for $alias should probably be an empty string, Doctrine_Table:1120
- '#Parameter \#1 \$alias of method Doctrine_Table::processOrderBy\(\) expects string, string\|null given\.#'
# Should change to empty string as default, Doctrine_Import_Schema:271
- '#Parameter \#1 \$path of method Doctrine_Import_Builder::setTargetPath\(\) expects string, string\|null given\.#'
# In Doctrine_Query_Abstract:1616, $from really shouldn't be allowed to be "null" since once it's passed to the _addDqlQueryPart method an
# exception will be thrown.
- '#Parameter \#2 \$queryPart of method Doctrine_Query_Abstract::_addDqlQueryPart\(\) expects int\|string, string\|null given\.#'
# Another case where the default should probably be an empty string instead of null, Doctrine_Query_Abstract:1874
- '#Property Doctrine_Query_Abstract::\$_resultCacheHash \(string\) does not accept string\|null\.#'
# The Doctrine_Connection_Mssql::replaceBoundParamsWithInlineValuesInQuery method may return null if the preg_replace_callback
# function encounters an error, which would cause $query to be null. Not sure what do do in this error situation.
- '#Parameter \#1 \$query of method Doctrine_Connection::execute\(\) expects string, string\|null given\.#'
- '#Parameter \#1 \$query of method Doctrine_Connection::exec\(\) expects string, string\|null given\.#'
# Oracle adapter will throw an exception if $this->connection is false after it tries to connect, so shouldn't be passing false around here
- '#Parameter \#1 \$connection of function oci_commit expects resource, false\|resource given\.#'
- '#Parameter \#1 \$connection of function oci_rollback expects resource, false\|resource given\.#'
# Doctrine_Table::getIdentifier may return a string or an array (an array if the primary key is multi-column), would need
# to check that this value isn't an array. Doctrine_Connection_UnitOfWork:947
- '#Invalid array key type array\|string\.#'
# Shouldn't be null here, but could be
- '#Parameter \#1 \$connection of function oci_parse expects resource, false\|resource given\.#'