> */ public function getNodeTypes() : array { return [BooleanAnd::class]; } /** * @param BooleanAnd $node */ public function refactor(Node $node) : ?Node { if ($node->left instanceof FuncCall && $this->isName($node->left, 'is_object') && $node->right instanceof Instanceof_) { return $this->processRemoveUselessIsObject($node->left, $node->right); } if (!$node->left instanceof Instanceof_) { return null; } if (!$node->right instanceof FuncCall) { return null; } if (!$this->isName($node->right, 'is_object')) { return null; } return $this->processRemoveUselessIsObject($node->right, $node->left); } private function processRemoveUselessIsObject(FuncCall $funcCall, Instanceof_ $instanceof) : ?Instanceof_ { if ($funcCall->isFirstClassCallable()) { return null; } $args = $funcCall->getArgs(); if (!isset($args[0])) { return null; } if (!$this->nodeComparator->areNodesEqual($args[0]->value, $instanceof->expr)) { return null; } return $instanceof; } }