Skip to content

Commit

Permalink
Merge pull request #21 from martin-helmich/bugfix/issue-20
Browse files Browse the repository at this point in the history
Only check for WS after operator when RValue exists
  • Loading branch information
martin-helmich authored Dec 7, 2016
2 parents 3247981 + 0bb65bd commit 37b0156
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function sniff(array $tokens, File $file, LinterConfiguration $configurat
// Scan forward until we find the actual operator
for ($j = 0; $j < $count && !self::isOperator($tokensInLine[$j]); $j ++);

if (isset($tokensInLine[$j + 1]) && self::isBinaryOperator($tokensInLine[$j])) {
if (isset($tokensInLine[$j + 1]) && isset($tokensInLine[$j + 2]) && self::isBinaryOperator($tokensInLine[$j])) {
if (!self::isWhitespace($tokensInLine[$j + 1])) {
$file->addWarning(new Warning(
$tokensInLine[$j]->getLine(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ c =3
d = 3
e=4
f< a
g <a
g <a
h =
j = foo

0 comments on commit 37b0156

Please sign in to comment.