Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlevomatCodingStandard.Operators.DisallowEqualOperators: prevent risky fix #18

Merged
merged 1 commit into from Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
geerteltink marked this conversation as resolved.
Show resolved Hide resolved
}

public function testUseNullCoalesceOperator(): void
Expand Down