New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to have no macros in Compiler #177
Conversation
Ou shit, nette/tester v2.0 requires >=5.6. My mistake. |
composer.json
Outdated
@@ -20,7 +20,7 @@ | |||
"ext-tokenizer": "*" | |||
}, | |||
"require-dev": { | |||
"nette/tester": "~1.7", | |||
"nette/tester": "^2.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave 1.7, it must work with PHP 5.4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yop, my mistake.
src/Latte/Compiler/Compiler.php
Outdated
@@ -124,7 +124,7 @@ public function compile(array $tokens, $className) | |||
$this->methods = ['main' => null, 'prepare' => null]; | |||
|
|||
$macroHandlers = new \SplObjectStorage; | |||
array_map([$macroHandlers, 'attach'], call_user_func_array('array_merge', $this->macros)); | |||
array_map([$macroHandlers, 'attach'], $this->macros ? call_user_func_array('array_merge', $this->macros): []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exited with error code 255 (expected 0)
E_WARNING: array_merge() expects at least 1 parameter, 0 given
@@ -124,7 +124,10 @@ public function compile(array $tokens, $className) | |||
$this->methods = ['main' => null, 'prepare' => null]; | |||
|
|||
$macroHandlers = new \SplObjectStorage; | |||
array_map([$macroHandlers, 'attach'], call_user_func_array('array_merge', $this->macros)); | |||
|
|||
if ($this->macros) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is condition needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it triggers
Exited with error code 255 (expected 0)
E_WARNING: array_merge() expects at least 1 parameter, 0 given
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, good.
Please fix coding style errors and I'll merge it. |
Thanks. |
This PR has 2 changes: