diff --git a/src/View/Antlers/Language/Parser/DocumentParser.php b/src/View/Antlers/Language/Parser/DocumentParser.php index 14adb46cce8..1bf3ea9a2d3 100644 --- a/src/View/Antlers/Language/Parser/DocumentParser.php +++ b/src/View/Antlers/Language/Parser/DocumentParser.php @@ -944,6 +944,7 @@ private function scanToEndOfDirective() $this->nodes[] = $node; $this->lastAntlersNode = $node; $this->startIndex = $this->currentIndex; + $this->currentIndex += 1; } private function advanceWhitespace() diff --git a/tests/Antlers/Parser/DirectivesTest.php b/tests/Antlers/Parser/DirectivesTest.php index 3efb6620ca6..a3fe56216dc 100644 --- a/tests/Antlers/Parser/DirectivesTest.php +++ b/tests/Antlers/Parser/DirectivesTest.php @@ -34,4 +34,23 @@ public function test_directives_args_must_be_finished() $this->renderString('@props ("this isnt()", "done!"'); } + + public function test_directives_dont_leave_extra_parenthesis() + { + $template = <<<'EOT' +@props([ + +])a + +Hellow +EOT; + + $expected = <<<'EOT' +a + +Hellow +EOT; + + $this->assertSame($expected, $this->renderString($template)); + } }