Skip to content

Commit aed23b9

Browse files
committed
Use the new allowTruncatedParentheses option by default
1 parent 8061951 commit aed23b9

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/JsPhpize/JsPhpizePhug.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ class JsPhpizePhug extends CompilerModule
1414

1515
public function __construct(array $options = [])
1616
{
17-
$this->options = array_merge([
17+
$this->options = array_merge_recursive([
18+
'allowTruncatedParentheses' => true,
1819
'catchDependencies' => true,
20+
'helpers' => [
21+
'dot' => 'dotWithArrayPrototype',
22+
],
1923
], $options);
2024
}
2125

tests/JsPhpize/JsPhpizePhugTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,22 @@ public function testTruncatedCode()
7878
'modules' => [JsPhpizePhug::class],
7979
]);
8080

81-
$compiler->setOption('jsphpize_engine', new JsPhpize());
81+
$compiler->setOption('jsphpize_engine', new JsPhpize([
82+
'allowTruncatedParentheses' => true,
83+
'catchDependencies' => true,
84+
'helpers' => [
85+
'dot' => 'dotWithArrayPrototype',
86+
],
87+
]));
8288

8389
$jsPhpize = $compiler->getFormatter()->getOption(['patterns', 'transform_expression']);
8490

91+
self::assertSame(
92+
'call_user_func(call_user_func($GLOBALS[\'__jpv_dotWithArrayPrototype\'], $items, ' .
93+
'\'forEach\'), function ($item) {',
94+
$jsPhpize('items.forEach(function (item) {')
95+
);
96+
8597
self::assertSame(
8698
'',
8799
$jsPhpize('')

0 commit comments

Comments
 (0)