Skip to content

Instantly share code, notes, and snippets.

@maks-rafalko
Created October 14, 2017 22:49
Show Gist options
  • Save maks-rafalko/ffaddab4cd6519c4b7d18bb43eb57977 to your computer and use it in GitHub Desktop.
Save maks-rafalko/ffaddab4cd6519c4b7d18bb43eb57977 to your computer and use it in GitHub Desktop.
<?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