Open swissspidy opened 1 year ago
Code like sprintf( 'Rotated at %d%% degrees', 90 ) is totally fine, yet the valid-sprintf rule currently flags this.
sprintf( 'Rotated at %d%% degrees', 90 )
valid-sprintf
The PHP counterpart does not flag this as it uses a different regex, see https://github.com/WordPress/WordPress-Coding-Standards/blob/1767f3a1169407d84f1d17e4cd9d80844d693e9e/WordPress/Sniffs/WP/I18nSniff.php#L45-L68
Improve the regex so that cases like %d%% or %d %% are not flagged as multiple unordered placeholders.
%d%%
%d %%
@swissspidy could this be a duplicate of this? https://github.com/WordPress/gutenberg/issues/47794
No relation at all!
What problem does this address?
Code like
sprintf( 'Rotated at %d%% degrees', 90 )
is totally fine, yet thevalid-sprintf
rule currently flags this.The PHP counterpart does not flag this as it uses a different regex, see https://github.com/WordPress/WordPress-Coding-Standards/blob/1767f3a1169407d84f1d17e4cd9d80844d693e9e/WordPress/Sniffs/WP/I18nSniff.php#L45-L68
What is your proposed solution?
Improve the regex so that cases like
%d%%
or%d %%
are not flagged as multiple unordered placeholders.