You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The sniff doesn't recognize unary minus applied to a number used with theexit language construct.
Code sample
<?phpfunctiontest()
{
exit -1;
}
Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
Run phpcs -s --standard=PSR12 --sniffs=PSR12.Operators.OperatorSpacing test.php
FILE: /home/morozov/Projects/phpcs-playground/test.php
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
5 | ERROR | [x] Expected at least 1 space after "-"; 0 found
| | (PSR12.Operators.OperatorSpacing.NoSpaceAfter)
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
Time: 33ms; Memory: 6MB
Run phpcbf --standard=PSR12 --sniffs=PSR12.Operators.OperatorSpacing test.php
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
/home/morozov/Projects/phpcs-playground/test.php 1 0
----------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
----------------------------------------------------------------------
Time: 37ms; Memory: 6MB
The resulting file contents are:
<?phpfunctiontest()
{
exit - 1;
}
Expected behavior
No error is reported.
Versions (please complete the following information):
OS: Linux
PHP: 7.4.9
PHPCS: 3.5.6
Standard: PSR-12
The text was updated successfully, but these errors were encountered:
Describe the bug
The sniff doesn't recognize unary minus applied to a number used with the
exit
language construct.Code sample
Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
phpcs -s --standard=PSR12 --sniffs=PSR12.Operators.OperatorSpacing test.php
phpcbf --standard=PSR12 --sniffs=PSR12.Operators.OperatorSpacing test.php
The resulting file contents are:
Expected behavior
No error is reported.
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: