Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TwigComponent/src/Twig/TwigPreLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function preLexComponents(string $input): string
private function consumeComponentName(string $customExceptionMessage = null): string
{
$start = $this->position;
while ($this->position < $this->length && preg_match('/[A-Za-z0-9_:@\-\/.]/', $this->input[$this->position])) {
while ($this->position < $this->length && preg_match('/[A-Za-z0-9_:@\-.]/', $this->input[$this->position])) {
++$this->position;
}

Expand Down
9 changes: 5 additions & 4 deletions src/TwigComponent/tests/Unit/TwigPreLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function getLexTests(): iterable
'{{ component(\'foo\', { bar: true }) }}',
];

yield 'attribute_with_no_value_and_no_attributes' => [
'<twig:foo/>',
'{{ component(\'foo\') }}',
];

yield 'component_with_default_block_content' => [
'<twig:foo>Foo</twig:foo>',
'{% component \'foo\' %}{% block content %}Foo{% endblock %}{% endcomponent %}',
Expand All @@ -83,10 +88,6 @@ public function getLexTests(): iterable
'<twig:foo-bar></twig:foo-bar>',
'{% component \'foo-bar\' %}{% endcomponent %}',
];
yield 'component_with_character_/_on_his_name' => [
'<twig:foo/bar></twig:foo/bar>',
'{% component \'foo/bar\' %}{% endcomponent %}',
];
yield 'component_with_character_._on_his_name' => [
'<twig:foo.bar></twig:foo.bar>',
'{% component \'foo.bar\' %}{% endcomponent %}',
Expand Down