PhpStorm: Language Injection Prefix

What I'm trying to do is have a string in a function parameter be treated as a SQL relation (table or view):

$result = selectFromTable('public.users');

So, what I did was created a Language Injection with the following "Place Patterns":

+ phpFirstArgument(phpWithName(string().oneOf("selectFromTable")))

I then set the language to PostgreSQL, and set "Prefix:" to: (no quotes)

"SELECT * FROM "

And... while it does pickup that SQL should be used in the first argument, it doesn't take into account the Prefix value and asks me to enter a statement...

What did I do wrong? Is it possible to do this?\

 

Bonus points: How would you do this for a column? example code: (see first parameter of DB->where())

$result = (new DB('public.users'))->where('username', '=', 'john.doe')->select();
3 comments
Comment actions Permalink

It seems prefixes don't work in PHP context. Here's JS' CSS colors injection applied to PHP:

PHPStorm is interpreting the string as CSS but not including the prefix or suffix:

 

2
Comment actions Permalink

Is there a YouTrack issue for this?
I'm sad that this feature exists but doesn't work.... and it's been 1.5+ years later

0
Comment actions Permalink

There is the ticket and I can see that you are already following it. Our team is aware of the bug and the work on it is in our plans.

0

Please sign in to leave a comment.