Open
Description
Is your feature request related to a problem?
Given the following code snippet:
$wpdb->query(
$wpdb->prepare(
'TRUNCATE TABLE `%1$s`',
plugin_get_table_name( 'Name' )
)
);
WPCS will currently throw the following warning:
WARNING | Complex placeholders used for values in the query string in $wpdb->prepare() will
NOT be quoted automagically. Found: %1$s.
(WordPress.DB.PreparedSQLPlaceholders.UnquotedComplexPlaceholder)
Describe the solution you'd like
In this particular case, I believe the warning should not be thrown.
Instead the sniff should recognize the backticks as valid "quotes" for a table name.
Note: this should only be accepted for table names, so, the sniff should probably look for TABLE
or FROM
before the placeholder.
Some research may need to be done into the various SQL syntaxes to make sure that the sniff recognizes the correct keywords and doesn't miss any real unquoted placeholders.