Skip to content

Commit

Permalink
Merge pull request #18 from autowp/develop
Browse files Browse the repository at this point in the history
SlevomatCodingStandard.Operators.DisallowEqualOperators: prevent risky fix
  • Loading branch information
geerteltink committed Sep 8, 2020
2 parents 72afc6b + 1e995d1 commit bfdfbf3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/LaminasCodingStandard/ruleset.xml
Expand Up @@ -644,7 +644,7 @@
</rule>
<!-- Loose comparison operators SHOULD NOT be used, use strict comparison
operators instead. -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators" phpcs-only="true"/>
<!-- The null coalesce operator MUST be used when possible. -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<!-- Assignment operators SHOULD be used when possible. -->
Expand Down
1 change: 1 addition & 0 deletions test/fixable/6.Operators.php
Expand Up @@ -84,6 +84,7 @@ public function testUseStrictComparisonOperators(): void
{
// Loose comparison operators SHOULD NOT be used, use strict comparison
// operators instead.
// Fix that manually.

$foo == 123;
123 == $foo;
Expand Down
9 changes: 5 additions & 4 deletions test/fixed/6.Operators.php
Expand Up @@ -83,11 +83,12 @@ public function testUseStrictComparisonOperators(): void
{
// Loose comparison operators SHOULD NOT be used, use strict comparison
// operators instead.
// Fix that manually.

$foo === 123;
123 === $foo;
true !== 0.0;
false !== true;
$foo == 123;
123 == $foo;
true != 0.0;
false <> true;
}

public function testUseNullCoalesceOperator(): void
Expand Down

0 comments on commit bfdfbf3

Please sign in to comment.