Permalink
Browse files

Require space after typecast when concatenation before.

Follow-up to 37a3f5d
  • Loading branch information...
cbandy committed Aug 28, 2011
1 parent 37a3f5d commit 28f647d7d5887e06485da39925a650e3e417a949
@@ -58,12 +58,10 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$before = $tokens[$stackPtr - 1];
$after = $tokens[$stackPtr + 1];
- if ($before['type'] !== 'T_STRING_CONCAT'
- AND ($before['type'] !== 'T_WHITESPACE'
- OR ($tokens[$stackPtr]['line'] !== $tokens[$stackPtr - 2]['line'] + 1
- AND $before['content'] !== ' ')
- OR $after['type'] !== 'T_WHITESPACE'
- OR $after['content'] !== ' '))
+ if (($after['type'] !== 'T_WHITESPACE' OR $after['content'] !== ' ')
+ OR ($before['type'] !== 'T_STRING_CONCAT'
+ AND ($before['type'] !== 'T_WHITESPACE' OR $before['content'] !== ' ')
+ AND $tokens[$stackPtr]['line'] !== $tokens[$stackPtr - 2]['line'] + 1))
{
$error = 'Typecast operators must be first on the line or have a space on either side';
$phpcsFile->addError($error, $stackPtr);
@@ -7,4 +7,5 @@ $foo = (integer) $bar;
$foo = (boolean) $bar;
(int) $indented;
-'{'.(int) $digits.'}'
+'{'.(int) $digits.'}';
+'{'.(int)$digits.'}';
@@ -40,7 +40,8 @@ public function getErrorList()
return array(
3 => 1,
6 => 1,
- 7 => 1
+ 7 => 1,
+ 11 => 1,
);
}
@@ -13,4 +13,4 @@ $test = 'extra'
.'indentation';
-'{'.(int) $digits.'}'
+'{'.(int) $digits.'}';

0 comments on commit 28f647d

Please sign in to comment.