Skip to content

Commit

Permalink
UselessParenthesesSniff: Fixed internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Oct 5, 2018
1 parent 06d996b commit 057f3f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -269,7 +269,6 @@ private function checkParenthesesAroundVariableOrFunctionCall(File $phpcsFile, i

do {
$nextPointer = TokenHelper::findNextEffective($phpcsFile, $contentEndPointer + 1);

if ($tokens[$nextPointer]['code'] !== T_OPEN_PARENTHESIS) {
break;
}
Expand All @@ -278,6 +277,10 @@ private function checkParenthesesAroundVariableOrFunctionCall(File $phpcsFile, i
} while (true);
} else {
$nextPointer = TokenHelper::findNext($phpcsFile, T_OPEN_PARENTHESIS, $notBooleanNotOperatorPointer + 1);
if ($nextPointer === null) {
return;
}

$contentEndPointer = $tokens[$nextPointer]['parenthesis_closer'];
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Sniffs/PHP/data/uselessParenthesesNoErrors.php
Expand Up @@ -100,3 +100,7 @@ function () {
include_once($file);
require($file);
require_once($file);

return true
? 100
: (int) ((100 / 50) * 100);

0 comments on commit 057f3f1

Please sign in to comment.