How to set up phpcs with WordPress coding standard with PHP8?

Apparently PHPCS (link to issue) and WPCS (link to issue) do not work at this point with PHP8 and won’t until their next releases.

It’s therefore recommended to use PHP 7.4 instead.

“Hack” option

Before downgrading my system to PHP7, I tried this hack. It seems to work for me, at least for the brief testing I did. But it might cause any kinds of issues, so use it at you own risk.

Replacing the content of the local ControlStructureSpacingSniff.php file
(in /WordPress/Sniffs/WhiteSpace/ of the cloned repo or the vendor folder of the composer installation) with the one from the develop branch.