public function testRewriteArbitraryKeyAsSetter()
 {
     /** @var \Pharborist\Operators\AssignNode $expr */
     $expr = Parser::parseExpression('$form_state["foo"]["baz"] = "bar"');
     $rewritten = $this->plugin->rewriteAsSetter($expr->getLeftOperand(), 'foo', $expr);
     $this->assertInstanceOf('\\Pharborist\\Objects\\ObjectMethodCallNode', $rewritten);
     $this->assertEquals('$form_state->set(["foo", "baz"], "bar")', $rewritten->getText());
 }
 public function testRewriteInvalidPropertyAsSetter()
 {
     /** @var \Pharborist\Operators\AssignNode $expr */
     $expr = Parser::parseExpression('$node->baz = "Blorf!"');
     $rewritten = $this->plugin->rewriteAsSetter($expr->getLeftOperand(), 'baz', $expr);
     $this->assertNull($rewritten);
     /** @var \Pharborist\Operators\AssignNode $expr */
     $expr = Parser::parseExpression('$node->nid = 30');
     $rewritten = $this->plugin->rewriteAsSetter($expr->getLeftOperand(), 'nid', $expr);
     $this->assertNull($rewritten);
 }