- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
I'm using the INF
const in our codebase along with a case for -INF
, this triggers rule Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
on the following example, which is unexpected.
Code sample
return match ($value) { 'Infinity' => INF, '-Infinity' => -INF, default => (float) $value, };
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above... - Run
phpcs test.php ...
- See error message displayed
ERROR | [x] Expected at least 1 space after "-"; 0 found (PSR12.Operators.OperatorSpacing.NoSpaceAfter) ERROR | [x] Expected 1 space after "-"; 0 found (Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter)
Expected behavior
space after -
is not required
Versions (please complete the following information):
- PHP: 8.1
- PHPCS: 3.7.1
- Standard: Slevomat, PSR12, Squiz
Additional context
this also conflicts with SlevomatCodingStandard.Operators.NegationOperatorSpacing.InvalidSpaceAfterMinus
that correctly recognises INF as a number
Metadata
Metadata
Assignees
Labels
No labels