[TwigComponent] ingore content when printed as string

by @bernard-ng

Some issues have been detected in this pull request

0
Coding Standard

0
Common Typos

0
File Permissions

0
Merge Commits

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/ux/1782/5eafce8849b91b818fa2c51d4e2e7bd28ea33827/exception_messages.diff | patch -p0
diff -ru src/TwigComponent/src/Twig/TwigPreLexer.php src/TwigComponent/src/Twig/TwigPreLexer.php
--- src/TwigComponent/src/Twig/TwigPreLexer.php	2024-04-27 16:09:13.066216040 +0000
+++ src/TwigComponent/src/Twig/TwigPreLexer.php	2024-04-27 16:09:13.991248594 +0000
@@ -167,7 +167,7 @@
                 $lastComponentName = $lastComponent['name'];
 
                 if ($closingComponentName !== $lastComponentName) {
-                    throw new SyntaxError("Expected closing tag '</twig:{$lastComponentName}>' but found '</twig:{$closingComponentName}>'", $this->line);
+                    throw new SyntaxError("Expected closing tag '</twig:{$lastComponentName}>' but found '</twig:{$closingComponentName}>'.", $this->line);
                 }
 
                 // we've reached the end of this component. If we're inside the
@@ -313,13 +313,13 @@
     private function consumeChar($validChars = null): string
     {
         if ($this->position >= $this->length) {
-            throw new SyntaxError('Unexpected end of input', $this->line);
+            throw new SyntaxError('Unexpected end of input.', $this->line);
         }
 
         $char = $this->input[$this->position];
 
         if (null !== $validChars && !\in_array($char, (array) $validChars, true)) {
-            throw new SyntaxError('Expected one of ['.implode('', (array) $validChars)."] but found '{$char}'.", $this->line);
+            throw new SyntaxError('Expected one of [.'.implode('', (array) $validChars)."] but found '{$char}'.", $this->line);
         }
 
         ++$this->position;
@@ -368,7 +368,7 @@
     private function expectAndConsumeChar(string $char): void
     {
         if (1 !== \strlen($char)) {
-            throw new \InvalidArgumentException('Expected a single character');
+            throw new \InvalidArgumentException('Expected a single character.');
         }
 
         if ($this->position >= $this->length) {

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages