Closed juneszh closed 4 years ago
With array you need to specify return type:
public static function init($source = 'master') : Medoo
{ /*...*/ }
Or:
/**
* @return Medoo
*/
public static function init($source = 'master')
{ /*...*/ }
Without array extension should be able to recognize return type on its own, but when you explicitly write types there is greater chance to catch bugs and prevent unexpected behavior.
@bmewburn There is something wrong with type detection: when new instance is added to array then mysqli
type becomes mixed
With array you need to specify return type:
public static function init($source = 'master') : Medoo { /*...*/ }
Or:
/** * @return Medoo */ public static function init($source = 'master') { /*...*/ }
Without array extension should be able to recognize return type on its own, but when you explicitly write types there is greater chance to catch bugs and prevent unexpected behavior.
Thx! It's helpful for me.
It appears to be generalising the property type to array
which shouldn't be the case.
I packaged a
DB
class and return the instantiation from classmedoo
, but there isn't any auto-complete suggestion frommedoo
when i coding useDB
. Is that anything wrong in my code?