Skip to content
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

CS: remove yoda conditions from VIPCS codebase #571

Merged
merged 2 commits into from
Jul 30, 2020

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jul 30, 2020

PHPCS ruleset: forbid yoda conditions in VIPCS codebase

In contrast to WPCS, disallow the use of Yoda conditions.

CS: change yoda conditions to non-yoda

Fixes made with the auto-fixer available in the Slevomat standard via the SlevomatCodingStandard.ControlStructures.DisallowYodaComparison sniff and visually reviewed.

jrfnl added 2 commits July 30, 2020 04:54
In contrast to WPCS, disallow the use of Yoda conditions.
Fixes made with the auto-fixer available in the Slevomat standard via the `SlevomatCodingStandard.ControlStructures.DisallowYodaComparison` sniff and visually reviewed.
@jrfnl jrfnl added this to the 2.2.0 milestone Jul 30, 2020
@jrfnl jrfnl requested a review from a team as a code owner July 30, 2020 03:37
Copy link
Contributor

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, but would like @rebeccahum to chip in on this one.

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jul 30, 2020

@rebeccahum Please see the discussion Gary and me had about this on Slack for context.

@rebeccahum
Copy link
Contributor

d5v1hk8-00f17bce-6077-413a-8f24-b7909ec713c0

Since it seems like yoda is a preferential coding style, I'm fine with disabling the warning on the non-usage of it. However, is it necessary to enforce the usage of it when writing sniffs (I'm assuming for consistency)?

@jrfnl
Copy link
Collaborator Author

jrfnl commented Jul 30, 2020

However, is it necessary to enforce the usage of it when writing sniffs (I'm assuming for consistency)?

@rebeccahum I presume you mean "enforce that yoda conditions aren't used" ?

Necessary: no, helpful for keeping the codebase consistent: yes.

@GaryJones GaryJones merged commit 00d4f35 into develop Jul 30, 2020
@GaryJones GaryJones deleted the fix/no-yoda-in-own-codebase branch July 30, 2020 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants