mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-18 03:31:41 +00:00
Improve deprecation message
See https://github.com/twigphp/Twig/pull/4199#discussion_r1723456834
This commit is contained in:
+2
-2
@@ -418,7 +418,7 @@ class Lexer
|
||||
$result .= $nextChar;
|
||||
} elseif ("'" === $nextChar || '"' === $nextChar) {
|
||||
if ($nextChar !== $quoteType) {
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d does not need to be escaped anymore.', $nextChar, $i + 1);
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1);
|
||||
}
|
||||
$result .= $nextChar;
|
||||
} elseif ('#' === $nextChar && $i + 1 < $length && '{' === $str[$i + 1]) {
|
||||
@@ -437,7 +437,7 @@ class Lexer
|
||||
}
|
||||
$result .= \chr(octdec($octal));
|
||||
} else {
|
||||
trigger_deprecation('twig/twig', '3.12', \sprintf('Character "%s" at position %d does not need to be escaped anymore.', $nextChar, $i + 1));
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.', $nextChar, $i + 1);
|
||||
$result .= $nextChar;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -252,17 +252,17 @@ class LexerTest extends TestCase
|
||||
yield '{{ \'App\Test\' }} => AppTest' => [
|
||||
'{{ \'App\\Test\' }}',
|
||||
'AppTest',
|
||||
'Since twig/twig 3.12: Character "T" at position 5 does not need to be escaped anymore.',
|
||||
'Since twig/twig 3.12: Character "T" at position 5 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
];
|
||||
yield '{{ "foo \\\' bar" }} => foo \' bar' => [
|
||||
'{{ "foo \\\' bar" }}',
|
||||
'foo \' bar',
|
||||
"Since twig/twig 3.12: Character \"'\" at position 6 does not need to be escaped anymore.",
|
||||
'Since twig/twig 3.12: Character "\'" at position 6 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
];
|
||||
yield '{{ \'foo \" bar\' }} => foo " bar' => [
|
||||
'{{ \'foo \\" bar\' }}',
|
||||
'foo " bar',
|
||||
'Since twig/twig 3.12: Character """ at position 6 does not need to be escaped anymore.',
|
||||
'Since twig/twig 3.12: Character """ at position 6 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user