Method not found
dear all,
i am using an array to store several db connections inside, so at many lines i use this in my code:
$ret = $this->db[$this->mode]['produkte']->sql_query("SELECT....");
of course phpstorm always says Method sql_query not found.
is there any way to let phpstorm know that this array $this->db is from class "db" ?
i know its working at other situations with special comments, but in this case i don´t know.
thanks for any help!
regards,
micha
请先登录再写评论。
Hi there,
I do not think (although not 100% sure on this) that currently PhpStorm is able to provide type hints for two-dimensional arrays ( $var['first']['second'] ). Single dimension ( $var['first'] ) -- easy.
If you can -- rewrite your code so only one or none at all dimensions is used, for example:
instead of $this->db[$this->mode]['bla-bla']
introduce function that takes 2 parameters, and you will use it this way: $this->getDB($this->mode, 'bla-bla');
Something like this:
or maybe even this way (if first parameter would be $this->mode all the time)
i will try, thank´s a lot for your advise ! ;)