-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
When using the PSR-12 implementation that ships with PHP_CodeSniffer, I cannot use union types as described in RFCs and other official or semi-official documentation.
Code sample
function foo(int|float $val) : void
{
//
}
Custom ruleset
<?xml version="1.0"?>
<ruleset name="My Custom Standard">
<rule ref="PSR12" />
</ruleset>
To reproduce
Steps to reproduce the behavior:
- Lint the file while running PHP 8.0 so you can use union types
- Get greeted with
PSR12.Operators.OperatorSpacing
errors (eitherNoSpaceBefore
orNoSpaceAfter
):
ERROR | [x] Expected at least 1 space after "|"; 0 found
Expected behavior
I would expect to be able to use PSR-12 operator spacing lints without it complaining about union type delimiters, as those to my understanding are not actually operators.
Versions (please complete the following information):
- OS: Linux Ubuntu
- PHP: 8.0 RC 1
- PHPCS: Latest 3.5 stable
- Standard: PSR12
Additional context
N/A
Metadata
Metadata
Assignees
Labels
No labels