mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 04:57:23 +00:00
Improve deprecation messages
This commit is contained in:
+2
-2
@@ -423,7 +423,7 @@ class Lexer
|
||||
$result .= $nextChar;
|
||||
} elseif ("'" === $nextChar || '"' === $nextChar) {
|
||||
if ($nextChar !== $quoteType) {
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d in string on line %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, $this->lineno);
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" should not be escaped; the "\" character is ignored in Twig 3 but will not be in Twig 4. Please remove the extra "\" character at position %d in "%s" at line %d.', $nextChar, $i + 1, $this->source->getName(), $this->lineno);
|
||||
}
|
||||
$result .= $nextChar;
|
||||
} elseif ('#' === $nextChar && $i + 1 < $length && '{' === $str[$i + 1]) {
|
||||
@@ -442,7 +442,7 @@ class Lexer
|
||||
}
|
||||
$result .= \chr(octdec($octal));
|
||||
} else {
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" at position %d in string on line %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, $this->lineno);
|
||||
trigger_deprecation('twig/twig', '3.12', 'Character "%s" should not be escaped; the "\" character is ignored in Twig 3 but will not be in Twig 4. Please remove the extra "\" character at position %d in "%s" at line %d.', $nextChar, $i + 1, $this->source->getName(), $this->lineno);
|
||||
$result .= $nextChar;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -281,7 +281,7 @@ class LexerTest extends TestCase
|
||||
{{ 'App\Test' }}
|
||||
EOF,
|
||||
'AppTest',
|
||||
'Since twig/twig 3.12: Character "T" at position 5 in string on line 1 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
'Since twig/twig 3.12: Character "T" should not be escaped; the "\" character is ignored in Twig 3 but will not be in Twig 4. Please remove the extra "\" character at position 5 in "index" at line 1.',
|
||||
];
|
||||
yield [
|
||||
<<<'EOF'
|
||||
@@ -290,14 +290,14 @@ class LexerTest extends TestCase
|
||||
<<<'EOF'
|
||||
foo ' bar
|
||||
EOF,
|
||||
'Since twig/twig 3.12: Character "\'" at position 6 in string on line 1 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
'Since twig/twig 3.12: Character "\'" should not be escaped; the "\" character is ignored in Twig 3 but will not be in Twig 4. Please remove the extra "\" character at position 6 in "index" at line 1.',
|
||||
];
|
||||
yield [
|
||||
<<<'EOF'
|
||||
{{ 'foo \" bar' }}
|
||||
EOF,
|
||||
'foo " bar',
|
||||
'Since twig/twig 3.12: Character """ at position 6 in string on line 1 should not be escaped; the "\" character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character.',
|
||||
'Since twig/twig 3.12: Character """ should not be escaped; the "\" character is ignored in Twig 3 but will not be in Twig 4. Please remove the extra "\" character at position 6 in "index" at line 1.',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user