Skip to content

Commit

Permalink
Fix mixin js-phpize unneeded call
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Feb 15, 2017
1 parent ee240d4 commit feb835c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Jade/Compiler/ExpressionCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ protected function getPhpCodeFromJs($arguments)
{
if (
preg_match('/^\s*array\s*' . Scanner::PARENTHESES . '\s*$/i', $arguments[0]) ||
preg_match('/^\(*isset\(\$/i', $arguments[0])
preg_match('/^\(*isset\(\$/i', $arguments[0]) ||
(
preg_match('/^\s*array_merge\s*' . Scanner::PARENTHESES . '/i', $arguments[0]) &&
preg_match('/\s*array\s*' . Scanner::PARENTHESES . '\s*/i', $arguments[0])
)
) {
return $arguments[0];
}
Expand Down
3 changes: 3 additions & 0 deletions tests/features/expressionLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function testJsExpression()
$this->assertSame('array(1)', $actual);
$actual = trim($compiler->callPhpizeExpression('addDollarIfNeeded', 'a'));
$this->assertSame('$a', $actual);

$actual = trim($jade->render("mixin test\n div&attributes(attributes)\nbody\n +test()(class='test')"));
$this->assertSame('<body><div class="test "></div></body>', $actual);
}

public function testPhpExpression()
Expand Down

0 comments on commit feb835c

Please sign in to comment.