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
117
117
private function consumeComponentName (): string
118
118
{
119
119
$ 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 ])) {
121
121
++$ this ->position ;
122
122
}
123
123
$ 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
71
71
'<twig:foo>Foo <twig:bar /><twig:block name="other_block">Other block</twig:block></twig:foo> ' ,
72
72
'{% component \'foo \' %}{% block content %}Foo {% component \'bar \' %}{% endcomponent %}{% endblock %}{% block other_block %}Other block{% endblock %}{% endcomponent %} ' ,
73
73
];
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
+ ];
74
94
}
75
95
}
You can’t perform that action at this time.
0 commit comments