Skip to content

Commit eb28b6f

Browse files
authored
Cover sprintf in tests (#13)
1 parent 166802c commit eb28b6f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/Rules/MessageInterpolationRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function testSymfonyExample(): void
3636
'Using interpolated strings in log messages is potentially a security risk. Use PSR-3 placeholders instead.',
3737
22,
3838
],
39+
[
40+
'Using interpolated strings in log messages is potentially a security risk. Use PSR-3 placeholders instead.',
41+
24,
42+
],
3943
]);
4044
}
4145

tests/Rules/data/symfony-example.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function wrong(LoggerInterface $logger, string $s, $b)
2020
]);
2121

2222
$logger->info("Failed user login for {$_POST['username']}.");
23+
24+
$logger->error(\sprintf('Error with userId "%s"', $s));
2325
}
2426

2527
function good(LoggerInterface $logger, bool $nativeBool)

0 commit comments

Comments
 (0)