@@ -157,7 +157,7 @@ public function preLexComponents(string $input): string
157157 $ lastComponentName = $ lastComponent ['name ' ];
158158
159159 if ($ closingComponentName !== $ lastComponentName ) {
160- throw new SyntaxError ("Expected closing tag '</twig: {$ lastComponentName }>' but found '</twig: {$ closingComponentName }>' " , $ this ->line );
160+ throw new SyntaxError ("Expected closing tag '</twig: {$ lastComponentName }>' but found '</twig: {$ closingComponentName }>'. " , $ this ->line );
161161 }
162162
163163 // we've reached the end of this component. If we're inside the
@@ -260,7 +260,7 @@ private function consumeAttributes(string $componentName): string
260260 throw new SyntaxError (\sprintf ('Expected "=" after ":%s" when parsing the "<twig:%s" syntax. ' , $ key , $ componentName ), $ this ->line );
261261 }
262262
263- $ attributes [] = \sprintf ('%s: true ' , preg_match ('/[-:]/ ' , $ key ) ? "' $ key' " : $ key );
263+ $ attributes [] = \sprintf ('%s: true ' , preg_match ('/[-:@ ]/ ' , $ key ) ? "' $ key' " : $ key );
264264 $ this ->consumeWhitespace ();
265265 continue ;
266266 }
@@ -275,7 +275,7 @@ private function consumeAttributes(string $componentName): string
275275 $ attributeValue = $ this ->consumeAttributeValue ($ quote );
276276 }
277277
278- $ attributes [] = \sprintf ('%s: %s ' , preg_match ('/[-:]/ ' , $ key ) ? "' $ key' " : $ key , '' === $ attributeValue ? "'' " : $ attributeValue );
278+ $ attributes [] = \sprintf ('%s: %s ' , preg_match ('/[-:@ ]/ ' , $ key ) ? "' $ key' " : $ key , '' === $ attributeValue ? "'' " : $ attributeValue );
279279
280280 $ this ->expectAndConsumeChar ($ quote );
281281 $ this ->consumeWhitespace ();
@@ -303,13 +303,13 @@ private function consume(string $string): bool
303303 private function consumeChar ($ validChars = null ): string
304304 {
305305 if ($ this ->position >= $ this ->length ) {
306- throw new SyntaxError ('Unexpected end of input ' , $ this ->line );
306+ throw new SyntaxError ('Unexpected end of input. ' , $ this ->line );
307307 }
308308
309309 $ char = $ this ->input [$ this ->position ];
310310
311311 if (null !== $ validChars && !\in_array ($ char , (array ) $ validChars , true )) {
312- throw new SyntaxError ('Expected one of [ ' .implode ('' , (array ) $ validChars )."] but found ' {$ char }'. " , $ this ->line );
312+ throw new SyntaxError ('Expected one of [. ' .implode ('' , (array ) $ validChars )."] but found ' {$ char }'. " , $ this ->line );
313313 }
314314
315315 ++$ this ->position ;
@@ -358,7 +358,7 @@ private function consumeWhitespace(): void
358358 private function expectAndConsumeChar (string $ char ): void
359359 {
360360 if (1 !== \strlen ($ char )) {
361- throw new \InvalidArgumentException ('Expected a single character ' );
361+ throw new \InvalidArgumentException ('Expected a single character. ' );
362362 }
363363
364364 if ($ this ->position >= $ this ->length ) {
0 commit comments