nodeTypeResolver = $nodeTypeResolver; } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\Function_ $functionLike */ public function hasNeverFuncCall($functionLike) : bool { foreach ((array) $functionLike->stmts as $stmt) { if ($this->isWithNeverTypeExpr($stmt)) { return \true; } } return \false; } public function isWithNeverTypeExpr(Stmt $stmt) : bool { if ($stmt instanceof Expression) { $stmt = $stmt->expr; } if ($stmt instanceof Stmt) { return \false; } $stmtType = $this->nodeTypeResolver->getNativeType($stmt); return $stmtType instanceof NeverType; } }