Implemented in https://github.com/slevomat/coding-standard/commit/f7feec44cdaf9d9b290217afdd03d47978740e43
I'm open for more ideas what should be reported as useless parentheses.
@kukulich Looks like this wasn't catch https://github.com/doctrine/coding-standard/pull/70/files#diff-ed68ee80435e5b99183806044803ac8bR21
@carusogabriel Please try again :)
@kukulich Thank you, it works. I'll test in a large codebase during the week and give you feedback in more cases we can use it, or it's fine as it's. I've found a bug:
return new class ($number) { // The Sniff reports and removes this parentheses :(
}
@carusogabriel Fixed :)
@kukulich Some other cases we can cover:
function testing() {
- return ! (in_array($foo, ['bar', 'foo']));
+ return ! in_array($foo, ['bar', 'foo']);
}
function casting() {
- return (bool) (intval($foo));
+ return (bool) intval($foo);
}
@carusogabriel Done
I've encountered another false positive:
$rowData[] = $row['function']($item);
It 'fixes' it to:
$rowData[] = $row['function']$item;
which of course is invalid php
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.