Symfony-coding-standard icon indicating copy to clipboard operation
Symfony-coding-standard copied to clipboard

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

Open Khartir opened this issue 3 years ago • 2 comments

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

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

}

Khartir avatar Feb 22 '21 14:02 Khartir

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

Khartir avatar Mar 02 '21 18:03 Khartir

GH-183 would implicitly fix this.

mmoll avatar Mar 24 '21 15:03 mmoll