The solution offered by LazyOne really works. However, its implementation requires a little more context.
To accurately inform PHPSTORM about the variables you want to declare, a comment should be placed directly above extract () , not the parent function.
public function db(){ $db = new SQLite3('db/mysqlitedb.db'); $payments = $db->query('SELECT * FROM payments'); while ($pay = $payments->fetchArray()){ extract($pay); if (isset($to_user, $from_user, $amount)) echo "TO: {$to_user}| FROM: {$from_user}| $ {$amount} \n"; }; }
This is a working sample from my code (for some reason, it did not copy your data).
You can see immediately before I use the extract () function, which I declare hidden variables and data types in the comment block above it.
Bonus: if you intend to use extraction, I highly recommend that you use isset to make sure that the array you are processing contains the fields that you expect. example in the code above
source share