File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,5 +63,23 @@ public static function messageFormattingDataProvider(): \Generator
6363 ['value ' ],
6464 'Message with placeholders but incorrect number of values: %s, %s ' ,
6565 ];
66+
67+ yield [
68+ 'Message with a percentage: 42% ' ,
69+ [],
70+ 'Message with a percentage: 42% ' ,
71+ ];
72+
73+ // This test case is a bit of an odd one, you would not expect this to happen in practice unless the user intended
74+ // to format the message but did not add the proper placeholder. On PHP 8+ this will return the message as is, but
75+ // on PHP 7 it will return the message without the percentage sign because some processing is done by `vsprintf`.
76+ // You would however more likely expect the previous test case where no values are provided when no placeholders are present
77+ yield [
78+ 'Message with a percentage: 42% ' ,
79+ ['value ' ],
80+ \PHP_VERSION_ID >= 80000
81+ ? 'Message with a percentage: 42% '
82+ : 'Message with a percentage: 42 ' ,
83+ ];
6684 }
6785}
You can’t perform that action at this time.
0 commit comments