Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/Standards/Squiz/Sniffs/WhiteSpace/OperatorSpacingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ public function register()

// Returning/printing a negative value; eg. (return -1).
$this->nonOperandTokens += [
T_RETURN => T_RETURN,
T_ECHO => T_ECHO,
T_EXIT => T_EXIT,
T_PRINT => T_PRINT,
T_YIELD => T_YIELD,
T_FN_ARROW => T_FN_ARROW,
T_RETURN => T_RETURN,
T_ECHO => T_ECHO,
T_EXIT => T_EXIT,
T_PRINT => T_PRINT,
T_YIELD => T_YIELD,
T_FN_ARROW => T_FN_ARROW,
T_MATCH_ARROW => T_MATCH_ARROW,
];

// Trying to use a negative value; eg. myFunction($var, -2).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,11 @@ $a = 'a '.-$b;
$a = 'a '.- MY_CONSTANT;
$a = 'a '.- $b;

match ($a) {
'a' => -1,
'b', 'c', 'd' => -2,
default => -3,
};

/* Intentional parse error. This has to be the last test in the file. */
$a = 10 +
Original file line number Diff line number Diff line change
Expand Up @@ -471,5 +471,11 @@ $a = 'a '.-$b;
$a = 'a '.- MY_CONSTANT;
$a = 'a '.- $b;

match ($a) {
'a' => -1,
'b', 'c', 'd' => -2,
default => -3,
};

/* Intentional parse error. This has to be the last test in the file. */
$a = 10 +