Skip to content

Commit

Permalink
Notice: deprecated use of ';'
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 30, 2022
1 parent 043bd5a commit a1bbb08
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Latte/Macros/CoreMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,11 @@ public function macroVar(MacroNode $node, PhpWriter $writer): string
$res->append($node->name === 'default' ? '=>' : '=');
$var = false;

} elseif ($tokens->isCurrent(',') && $tokens->depth === 0) {
} elseif ($tokens->isCurrent(',', ';') && $tokens->depth === 0) {
if ($tokens->isCurrent(';')) {
trigger_error("Inside tag {{$node->name} {$node->args}} should be ';' replaced with ',' (on line $node->startLine)", E_USER_DEPRECATED);
}

if ($var === null) {
$res->append($node->name === 'default' ? '=>null' : '=null');
}
Expand Down Expand Up @@ -813,6 +817,18 @@ public function macroVar(MacroNode $node, PhpWriter $writer): string
public function macroExpr(MacroNode $node, PhpWriter $writer): string
{
$node->validate(true, [], $node->name === '=');
if ($node->name !== 'php') {
$tokens = $node->tokenizer;
while ($tokens->nextToken()) {
if ($tokens->isCurrent(';') && $tokens->depth === 0) {
trigger_error("The use of character ';' is deprecated in tag {{$node->name}}, try to use {php} (on line $node->startLine)", E_USER_DEPRECATED);
break;
}
}

$tokens->reset();
}

return $writer->write(
$node->name === '='
? 'echo %modify(%node.args) %node.line;'
Expand Down

0 comments on commit a1bbb08

Please sign in to comment.