Skip to content
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

Merged
merged 1 commit into from May 16, 2018
Merged

Allow to have no macros in Compiler #177

merged 1 commit into from May 16, 2018

Conversation

f3l1x
Copy link
Member

@f3l1x f3l1x commented May 16, 2018

  • bug fix: #176
  • BC break? no
  • doc PR: no needed

This PR has 2 changes:

  • upgrade nette/tester to v2.0
  • allow to use own Compiler with no defined macros

@f3l1x
Copy link
Member Author

@f3l1x f3l1x commented May 16, 2018

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",
Copy link
Member

@dg dg May 16, 2018

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

Copy link
Member Author

@f3l1x f3l1x May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yop, my mistake.

@@ -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): []);
Copy link
Member

@dg dg May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it needed?

Copy link
Member Author

@f3l1x f3l1x May 16, 2018

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) {
Copy link
Member

@dg dg May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is condition needed?

Copy link
Member Author

@f3l1x f3l1x May 16, 2018

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

Copy link
Member

@dg dg May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good.

@dg
Copy link
Member

@dg dg commented May 16, 2018

Please fix coding style errors and I'll merge it.

@f3l1x
Copy link
Member Author

@f3l1x f3l1x commented May 16, 2018

Thanks.

@dg dg merged commit 6596b79 into nette:v2.4 May 16, 2018
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants