djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
402 stars 102 forks source link

Symfony.ControlStructure.YodaConditions.Invalid not working with static class variables #188

Open Khartir opened 3 years ago

Khartir commented 3 years ago

Code like the following breaks the sniff, reporting an error either way:

if (foo::$bar === bar::$foo) {

}
Khartir commented 3 years ago

As a workaroung, I'm using https://github.com/slevomat/coding-standard#slevomatcodingstandardcontrolstructuresdisallowyodacomparisonrequireyodacomparison- which can handle this and also brings an auto-fixer.

mmoll commented 3 years ago

GH-183 would implicitly fix this.