File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public function preLexComponents(string $input): string
117117 private function consumeComponentName (): string
118118 {
119119 $ start = $ this ->position ;
120- while ($ this ->position < $ this ->length && preg_match ('/[A-Za-z0-9_:]/ ' , $ this ->input [$ this ->position ])) {
120+ while ($ this ->position < $ this ->length && preg_match ('/[A-Za-z0-9_:@\-\/. ]/ ' , $ this ->input [$ this ->position ])) {
121121 ++$ this ->position ;
122122 }
123123 $ componentName = substr ($ this ->input , $ start , $ this ->position - $ start );
Original file line number Diff line number Diff line change @@ -71,5 +71,25 @@ public function getLexTests(): iterable
7171 '<twig:foo>Foo <twig:bar /><twig:block name="other_block">Other block</twig:block></twig:foo> ' ,
7272 '{% component \'foo \' %}{% block content %}Foo {% component \'bar \' %}{% endcomponent %}{% endblock %}{% block other_block %}Other block{% endblock %}{% endcomponent %} ' ,
7373 ];
74+ yield 'component_with_character_:_on_his_name ' => [
75+ '<twig:foo:bar></twig:foo:bar> ' ,
76+ '{% component \'foo:bar \' %}{% endcomponent %} ' ,
77+ ];
78+ yield 'component_with_character_@_on_his_name ' => [
79+ '<twig:@foo></twig:@foo> ' ,
80+ '{% component \'@foo \' %}{% endcomponent %} ' ,
81+ ];
82+ yield 'component_with_character_-_on_his_name ' => [
83+ '<twig:foo-bar></twig:foo-bar> ' ,
84+ '{% component \'foo-bar \' %}{% endcomponent %} ' ,
85+ ];
86+ yield 'component_with_character_/_on_his_name ' => [
87+ '<twig:foo/bar></twig:foo/bar> ' ,
88+ '{% component \'foo/bar \' %}{% endcomponent %} ' ,
89+ ];
90+ yield 'component_with_character_._on_his_name ' => [
91+ '<twig:foo.bar></twig:foo.bar> ' ,
92+ '{% component \'foo.bar \' %}{% endcomponent %} ' ,
93+ ];
7494 }
7595}
You can’t perform that action at this time.
0 commit comments