betterNodeFinder = $betterNodeFinder; $this->nodeComparator = $nodeComparator; } public function isIfAndWithInstanceof(BooleanAnd $booleanAnd) : bool { if (!$booleanAnd->left instanceof Instanceof_) { return \false; } // only one instanceof check return !$booleanAnd->right instanceof Instanceof_; } public function isIfStmtExprUsedInNextReturn(If_ $if, Return_ $return) : bool { if (!$return->expr instanceof Expr) { return \false; } $ifExprs = $this->betterNodeFinder->findInstanceOf($if->stmts, Expr::class); return (bool) $this->betterNodeFinder->findFirst($return->expr, function (Node $node) use($ifExprs) : bool { return $this->nodeComparator->isNodeEqual($node, $ifExprs); }); } }