PDO objects showing Suggestions from mysqli as well

Example connection:

$dba = new PDO("mysql:host=123.456.789.012;dbname='someDb'", 'dbuser', 'dbpass');

PHPStorm shows suggestion methods from both MySQLi and PDO:

 

0
2 comments

Hm, is there any chance that $dba is used as mysqli somewhere else in the project? In fact, this is the only way that I was able to reproduce the issue.

1

No, only in a previous version of the code (and files auto-save).

I had to add:

/**
* @var PDO
*/

above the `$dba =` line, then click File > Invalidate Caches / Restart to fix it.

1

Please sign in to leave a comment.