Created
October 14, 2017 22:49
-
-
Save maks-rafalko/ffaddab4cd6519c4b7d18bb43eb57977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Plus implements Mutator | |
{ | |
public function mutate(Node $node) | |
{ | |
return new BinaryOp\Minus($node->left, $node->right, $node->getAttributes()); | |
} | |
public function shouldMutate(Node $node) : bool | |
{ | |
if (!($node instanceof BinaryOp\Plus)) { | |
return false; | |
} | |
if ($node->left instanceof Array_ && $node->right instanceof Array_) { | |
return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment