diff --git a/src/Fenom/Compiler.php b/src/Fenom/Compiler.php index fcd7a7c..bac8628 100644 --- a/src/Fenom/Compiler.php +++ b/src/Fenom/Compiler.php @@ -889,7 +889,12 @@ class Compiler return; } while ($tokens->is(Tokenizer::MACRO_STRING, T_VARIABLE)) { - $args[] = $param = $tokens->getAndNext(); + $param = $tokens->current(); + if($tokens->is(T_VARIABLE)) { + $param = ltrim($param, '$'); + } + $tokens->next(); + $args[] = $param; if ($tokens->is('=')) { $tokens->next(); if ($tokens->is(T_CONSTANT_ENCAPSED_STRING, T_LNUMBER, T_DNUMBER) || $tokens->isSpecialVal()) { diff --git a/tests/cases/Fenom/MacrosTest.php b/tests/cases/Fenom/MacrosTest.php index 6994a9c..d613010 100644 --- a/tests/cases/Fenom/MacrosTest.php +++ b/tests/cases/Fenom/MacrosTest.php @@ -31,7 +31,7 @@ class MacrosTest extends TestCase '); $this->tpl("import_custom.tpl", ' - {macro minus(x, y)} + {macro minus($x, $y)} new minus macros {/macro} {import [plus, minus] from "math.tpl" as math} @@ -88,6 +88,9 @@ class MacrosTest extends TestCase $this->assertSame('Imp: x + y = 3 , x - y - z = 3', Modifier::strip($tpl->fetch(array()), true)); } + /** + * @group importCustom + */ public function testImportCustom() { $tpl = $this->fenom->compile('import_custom.tpl');