Skip to content

Commit 19892d6

Browse files
committed
added TagParser::consumeCommaBeforeArguments()
1 parent c454d1c commit 19892d6

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/Latte/Compiler/TagParser.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,25 @@ public function isEnd(): bool
160160
}
161161

162162

163+
/**
164+
* Consumes the optional comma separating the tag name from its arguments.
165+
* Triggers deprecation when the comma is missing but arguments still follow.
166+
* A trailing modifier (|filter) is not considered arguments.
167+
* @internal
168+
*/
169+
public function consumeCommaBeforeArguments(string $tag): void
170+
{
171+
if (
172+
!$this->stream->tryConsume(',')
173+
&& !$this->isEnd()
174+
&& !$this->stream->is(Token::Php_FilterPipe)
175+
) {
176+
$position = $this->stream->peek()->position;
177+
trigger_error("Missing comma before arguments in {{$tag}} tag $position.", E_USER_DEPRECATED);
178+
}
179+
}
180+
181+
163182
/** @throws Latte\CompileException */
164183
private function parse(string $schema, bool $recovery = false): mixed
165184
{

0 commit comments

Comments
 (0)