Skip to content

[New Rule] Use Yoda Conditions #137

Closed
@matthiashamacher

Description

@matthiashamacher

Rule

Use Yoda Conditions to avoid assignments inside a condition statement.

Reason

With Yoda Conditions it is not possible to assign a variable inside a condition statement, which improves the code quality because it prevents possible assignment errors.

Implementation

Some other Frameworks, such as Symfony, are using Yoda Conditions and have checks for them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalNew rule proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions