example:

function blah() {
  ...
  return ($a['Hours'] < $b['Hours']) ? -1 : 1;
}

Gives: ERROR | Expected 1 space after "-"; 0 found

Encapsulating -1 in brackets causes it to pass but shouldn't be necessary. Like so:

return ($a['Hours'] < $b['Hours']) ? (-1) : 1;

Comments

das-peter’s picture

Status: Active » Fixed

To check this style we simply use Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff.
Klausi fixed the issue you mention in Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff itself and sent a pull request, which was accepted: https://github.com/klausi/PHP_CodeSniffer/commit/38272abf05d20398b19246f...
Thus an upgrade of PHP_CodeSniffer should fix this issue: pear upgrade PHP_CodeSniffer

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.