Skip to content

Commit 74cc7ff

Browse files
committed
UIMacros: modifiers are deprecated in {control} and {templatePrint}
1 parent 545f519 commit 74cc7ff

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/Bridges/ApplicationLatte/UIMacros.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public function finalize()
8181
*/
8282
public function macroControl(MacroNode $node, PhpWriter $writer)
8383
{
84+
if ($node->modifiers) {
85+
trigger_error('Modifiers are deprecated in ' . $node->getNotation(), E_USER_DEPRECATED);
86+
}
8487
$words = $node->tokenizer->fetchWords();
8588
if (!$words) {
8689
throw new CompileException('Missing control name in {control}');
@@ -165,6 +168,9 @@ public function macroExtends(MacroNode $node, PhpWriter $writer)
165168
*/
166169
public function macroTemplatePrint(MacroNode $node): void
167170
{
171+
if ($node->modifiers) {
172+
throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
173+
}
168174
$this->printTemplate = var_export($node->tokenizer->fetchWord() ?: null, true);
169175
}
170176
}

tests/Bridges.Latte/UIMacros.control.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ UIMacros::install($compiler);
1818

1919
// {control ...}
2020
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); ?>', $compiler->expandMacro('control', 'form', '')->openingCode);
21-
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->filter)(%a%); ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode);
21+
@Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->filter)(%a%); ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode); // @ deprecated
2222
Assert::match('<?php %a% if (is_object($form)) %a% else %a% $this->global->uiControl->getComponent($form); %a%->render(); ?>', $compiler->expandMacro('control', '$form', '')->openingCode);
2323
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType(); ?>', $compiler->expandMacro('control', 'form:type', '')->openingCode);
2424
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->{"render$type"}(); ?>', $compiler->expandMacro('control', 'form:$type', '')->openingCode);
2525
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType(\'param\'); ?>', $compiler->expandMacro('control', 'form:type param', '')->openingCode);
2626
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(array_merge([], $params, [])); ?>', $compiler->expandMacro('control', 'form (expand) $params', '')->openingCode);
2727
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType([\'param\' => 123]); ?>', $compiler->expandMacro('control', 'form:type param => 123', '')->openingCode);
2828
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType([\'param\' => 123]); ?>', $compiler->expandMacro('control', 'form:type, param => 123', '')->openingCode);
29-
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->striptags)(%a%); ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode);
29+
@Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->striptags)(%a%); ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode); // @ deprecated

0 commit comments

Comments
 (0)