Differential D21455 Diff 51065 src/lint/linter/xhpast/rules/__tests__/formatted-string/formatted-string.lint-test
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/__tests__/formatted-string/formatted-string.lint-test
<?php | <?php | ||||
printf(); | printf(); | ||||
printf(null); | printf(null); | ||||
printf(''); | printf(''); | ||||
sprintf('%s'); | sprintf('%s'); | ||||
pht('%s', 'foo', 'bar'); | pht('%s', 'foo', 'bar'); | ||||
fprintf(null, 'x'); | fprintf(null, 'x'); | ||||
queryfx(null, 'x', 'y'); | queryfx(null, 'x', 'y'); | ||||
foobar(null, null, '%s'); | foobar(null, null, '%s'); | ||||
pht('x %s y'); | pht('x %s y'); | ||||
pht('x %s y'.'z'); | pht('x %s y'.'z'); | ||||
pht(<<<HEREDOC | |||||
a b c | |||||
HEREDOC | |||||
); | |||||
pht(<<<HEREDOC | |||||
a %s c | |||||
HEREDOC | |||||
); | |||||
~~~~~~~~~~ | ~~~~~~~~~~ | ||||
error:3:1:XHP54:Formatted String | error:3:1:XHP54:Formatted String | ||||
error:7:1:XHP54:Formatted String | error:7:1:XHP54:Formatted String | ||||
error:8:1:XHP54:Formatted String | error:8:1:XHP54:Formatted String | ||||
error:11:1:XHP54:Formatted String | error:11:1:XHP54:Formatted String | ||||
error:13:1:XHP54:Formatted String | error:13:1:XHP54:Formatted String | ||||
error:15:1:XHP54:Formatted String | error:15:1:XHP54:Formatted String | ||||
error:16:1:XHP54:Formatted String | error:16:1:XHP54:Formatted String | ||||
error:23:1:XHP54:Formatted String | |||||
~~~~~~~~~~ | ~~~~~~~~~~ | ||||
~~~~~~~~~~ | ~~~~~~~~~~ | ||||
{ | { | ||||
"config": { | "config": { | ||||
"xhpast.printf-functions": { | "xhpast.printf-functions": { | ||||
"foobar": 2 | "foobar": 2 | ||||
} | } | ||||
} | } | ||||
} | } |