If you have installed PHP with homebrew you'd use pecl install xdebug to install Xdebug.
While looking for a fix I found this issue. And there I found this link following that I found out that someone has discovered something in a commit and now they have fixed it.
Upgrade PHP to PHP8.0.2 with brew upgrade php and then use pecl install xdebug and you're good to go. If you use
Vim and want to use xdebug in vim luckily there's a plugin for it Vdebug. Install this
plugin and xdebug will work in Vim.