How to tell IDE to ignore SQL syntax error
I have an SQL query that's being partially built by PHP, and the PHP-provided parts are inserted into the query via string variables. However, because the part being inserted by PHP is more than just a simple value (which the SQL parser handles okay), the resulting SQL string is not valid until runtime, and it's being marked as containing syntax errors. Here's a nicely contrived example:
$setClause = '`bar` = 3';
$sql = "INSERT INTO Foo SET $setClause";
This ends up with a red squiggle at the closing quote, and the inspection pop-up reports:
'=' expected, unexpected end of file
Since such errors propagate around in rather obvious fashion (big red bar on the side, file name in tab red-underlined, containing folder names in project red-underlined, etc.), I'd really like to supress it (but in general keep the in-your-face nature of such errors enabled, as I want that behavior elsewhere). However, I can't figure out how. My first thought was to simply uninject the SQL, but choosing that command appears to have no effect. How can I tell PhpStorm to not worry about this one error?
Please sign in to leave a comment.
unfortunately its currently not possible.
is this something we still can't do, 5 years later?
Yes, unfortunately.
I can't find related report on our bugtracker - probably no one ever reported this. Feel free to.
Added: https://youtrack.jetbrains.com/issue/WI-36306