Skip to content

Commit f6732bc

Browse files
committed
PHPCS doesn't use yoda conditions, so disallow them in the standard
1 parent 80a7c03 commit f6732bc

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
6161
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
6262
<rule ref="Generic.Commenting.Todo"/>
63+
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
6364
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
6465
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
6566
<rule ref="Generic.Formatting.SpaceAfterCast"/>

src/Files/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ public function findExtendedClassName($stackPtr)
25292529

25302530
$classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
25312531
$extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classOpenerIndex);
2532-
if (false === $extendsIndex) {
2532+
if ($extendsIndex === false) {
25332533
return false;
25342534
}
25352535

src/Reporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function __construct(Config $config)
143143
}
144144

145145
$reportClass = new $reportClassName();
146-
if (false === ($reportClass instanceof Report)) {
146+
if (($reportClass instanceof Report) === false) {
147147
throw new RuntimeException('Class "'.$reportClassName.'" must implement the "PHP_CodeSniffer\Report" interface.');
148148
}
149149

0 commit comments

Comments
 (0)