Skip to content

CS: remove yoda conditions from VIPCS codebase#571

Merged
GaryJones merged 2 commits into
developfrom
fix/no-yoda-in-own-codebase
Jul 30, 2020
Merged

CS: remove yoda conditions from VIPCS codebase#571
GaryJones merged 2 commits into
developfrom
fix/no-yoda-in-own-codebase

Conversation

@jrfnl

@jrfnl jrfnl commented Jul 30, 2020

Copy link
Copy Markdown
Collaborator

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

@GaryJones GaryJones left a comment

Copy link
Copy Markdown
Contributor

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

jrfnl commented Jul 30, 2020

Copy link
Copy Markdown
Collaborator Author

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

@rebeccahum

Copy link
Copy Markdown
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

jrfnl commented Jul 30, 2020

Copy link
Copy Markdown
Collaborator Author

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