@@ -157,7 +157,7 @@ public function preLexComponents(string $input): string
157
157
$ lastComponentName = $ lastComponent ['name ' ];
158
158
159
159
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 );
161
161
}
162
162
163
163
// we've reached the end of this component. If we're inside the
@@ -260,7 +260,7 @@ private function consumeAttributes(string $componentName): string
260
260
throw new SyntaxError (\sprintf ('Expected "=" after ":%s" when parsing the "<twig:%s" syntax. ' , $ key , $ componentName ), $ this ->line );
261
261
}
262
262
263
- $ attributes [] = \sprintf ('%s: true ' , preg_match ('/[-:]/ ' , $ key ) ? "' $ key' " : $ key );
263
+ $ attributes [] = \sprintf ('%s: true ' , preg_match ('/[-:@ ]/ ' , $ key ) ? "' $ key' " : $ key );
264
264
$ this ->consumeWhitespace ();
265
265
continue ;
266
266
}
@@ -275,7 +275,7 @@ private function consumeAttributes(string $componentName): string
275
275
$ attributeValue = $ this ->consumeAttributeValue ($ quote );
276
276
}
277
277
278
- $ attributes [] = \sprintf ('%s: %s ' , preg_match ('/[-:]/ ' , $ key ) ? "' $ key' " : $ key , '' === $ attributeValue ? "'' " : $ attributeValue );
278
+ $ attributes [] = \sprintf ('%s: %s ' , preg_match ('/[-:@ ]/ ' , $ key ) ? "' $ key' " : $ key , '' === $ attributeValue ? "'' " : $ attributeValue );
279
279
280
280
$ this ->expectAndConsumeChar ($ quote );
281
281
$ this ->consumeWhitespace ();
@@ -303,13 +303,13 @@ private function consume(string $string): bool
303
303
private function consumeChar ($ validChars = null ): string
304
304
{
305
305
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 );
307
307
}
308
308
309
309
$ char = $ this ->input [$ this ->position ];
310
310
311
311
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 );
313
313
}
314
314
315
315
++$ this ->position ;
@@ -358,7 +358,7 @@ private function consumeWhitespace(): void
358
358
private function expectAndConsumeChar (string $ char ): void
359
359
{
360
360
if (1 !== \strlen ($ char )) {
361
- throw new \InvalidArgumentException ('Expected a single character ' );
361
+ throw new \InvalidArgumentException ('Expected a single character. ' );
362
362
}
363
363
364
364
if ($ this ->position >= $ this ->length ) {
0 commit comments