-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Slevomat CS 5.0 #109
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for organising the order of sniffs, my OCD really appreciates it 👍
} | ||
|
||
public function uselessIfConditionWithBoolMethod() : bool | ||
{ | ||
return ! $this->isTrue(); | ||
if ($this->isTrue()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See slevomat/coding-standard#604 - CS doesn't know the type of $this->isTrue()
and in general it may produce broken code (the method would return non-bool). This is now still reported, but not auto-fixed.
@@ -70,7 +78,7 @@ public function uselessIfConditionWithComplexCondition() : bool | |||
public function uselessIfConditionWithTernary() : bool | |||
{ | |||
if ($this->isTrue()) { | |||
return $this->isTrulyTrue(); | |||
return $this->isTrulyTrue() ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See slevomat/coding-standard#604 - CS doesn't know the type of $this->isTrulyTrue()
and in general it may produce broken code (the method would return non-bool). This is now still reported, but not auto-fixed.
@@ -103,12 +111,12 @@ public function uselessTernary() : bool | |||
|
|||
public function uselessTernaryWithParameter(bool $condition) : bool | |||
{ | |||
return $condition; | |||
return $condition ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See slevomat/coding-standard#604 - CS doesn't know the type of $condition
and in general it may produce broken code (the method would return non-bool). This is now still reported, but not auto-fixed.
} | ||
|
||
public function uselessTernaryWithMethod() : bool | ||
{ | ||
return $this->isFalse(); | ||
return $this->isFalse() ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See slevomat/coding-standard#604 - CS doesn't know the type of $this->isFalse()
and in general it may produce broken code (the method would return non-bool). This is now still reported, but not auto-fixed.
If these are no longer fixed, shouldn't it be removed from fixed/ folder? |
No, they are still used for the tests of errors produced. They just can't be fixed anymore. |
isn't that what is input/ folder used for? |
Yes, but in Apply fixes stage, phpcbf is ran over input/ and diffed against fixed/. |
This only moves us to Slevomat CS 5.0 - no sniffs are added, changed or removed.
New sniffs and changes coming in upcoming PRs.