Using PHP 8.1 intersection types raises errors, because some sniffs read the ampersand of the intersection types as a by-reference.
/** * @param AClass & AnInterface $thing */ function changeThing( AClass & AnInterface $thing ): void { // }
The error message are
Pass-by-reference for parameter $thing does not match pass-by-reference of variable name $thing (MediaWiki.Commenting.FunctionComment.ParamPassByReference)
and
Expected 0 spaces after reference operator for argument "$thing"; 1 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterReference)
The latter sniff is an external dependency and not ready for PHP 8.1 intersection types yet (see https://github.com/squizlabs/PHP_CodeSniffer/issues/3479 ), but the former could theroretically be worked on already.