Issue #3392200 by jeremy_p, joachim, hdnag, yepa: Invalid placeholder error message should say what's wrong with it
parent
4f47df39cc
commit
8abb2835b6
|
@ -244,7 +244,7 @@ class FormattableMarkup implements MarkupInterface, \Countable {
|
||||||
default:
|
default:
|
||||||
if (!ctype_alnum($key[0])) {
|
if (!ctype_alnum($key[0])) {
|
||||||
// Warn for random placeholders that won't be replaced.
|
// Warn for random placeholders that won't be replaced.
|
||||||
trigger_error(sprintf('Invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING);
|
trigger_error(sprintf('Placeholders must begin with one of the following "@", ":" or "%%", invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
// No replacement possible therefore we can discard the argument.
|
// No replacement possible therefore we can discard the argument.
|
||||||
unset($args[$key]);
|
unset($args[$key]);
|
||||||
|
|
|
@ -117,7 +117,7 @@ class FormattableMarkupTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public function providerTestUnexpectedPlaceholder() {
|
public function providerTestUnexpectedPlaceholder() {
|
||||||
return [
|
return [
|
||||||
['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'],
|
['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Placeholders must begin with one of the following "@", ":" or "%", invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'],
|
||||||
['Alpha starting character: placeholder', ['placeholder' => 'replaced'], NULL, ''],
|
['Alpha starting character: placeholder', ['placeholder' => 'replaced'], NULL, ''],
|
||||||
// Ensure that where the placeholder is located in the string is
|
// Ensure that where the placeholder is located in the string is
|
||||||
// irrelevant.
|
// irrelevant.
|
||||||
|
|
Loading…
Reference in New Issue