Is there a way to avoid SQL inspections on non-SQL strings?
已回答
There's a number of place in my project where PhpStorm is assuming a piece of text is SQL, usually because the word "select" appears in the string. E.g.
$prompt = 'Select your country from the drop-down list.';
I'm pretty consistent in my use of case and always use "SELECT" in actual SQL strings, so maybe there's some way to tweak the inspection?
请先登录再写评论。
Hello,
Yes, you are absolutely right - SQL query language injection is being triggered by "Select *** from" words. You can check the injection at Settings\Preferences | Editor | Language Injections.
One way is to use PHPDoc like
Another way is to split string between "Select" and "from" like
Would any of this be suitable?
Yes, the PHPDoc snippet is exactly the sort of thing I was looking for. Thank you!