PhpStorm - Disable SQL inspection for one line

半腔热情 提交于 2019-12-01 21:36:19

Add \%\w+ pattern to Settings/Preferences | Tools | Database | User Parameters -- it will tell IDE to treat such %s as dynamic/external part of the code instead of actual SQL.

For example:

P.S. One day such pattern will be provided by default in PhpStorm.

https://youtrack.jetbrains.com/issue/WI-39271 -- watch this ticket (star/vote/comment) to get notified on any progress.


If you need an actual suppression .. then the most effective way is to treat the string as Plain Text instead of autodetected SQL.

For this, just place /** @lang text*/ just before the string, e.g.

$sql = /** @lang text*/'REPLACE INTO %s (id, NAME, cache_id, compile_id, content) VALUES (%s, %s, %s, %s, %s)';

NOTE: may not work if you are concatenating such string or perform other manipulations in place.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!