Skip to content

Commit 76c18f2

Browse files
committed
use conditionalTags
1 parent f91d89e commit 76c18f2

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

rules.neon

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ rules:
99
- PHPStan\Rules\PHPUnit\NoMissingSpaceInMethodAnnotationRule
1010
- PHPStan\Rules\PHPUnit\ShouldCallParentMethodsRule
1111

12+
conditionalTags:
13+
PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule:
14+
phpstan.rules.rule: [%strictRulesInstalled%, %featureToggles.bleedingEdge%]
15+
1216
services:
1317
-
1418
class: PHPStan\Rules\PHPUnit\DataProviderDeclarationRule
@@ -20,7 +24,3 @@ services:
2024

2125
-
2226
class: PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule
23-
arguments:
24-
strictRulesInstalled: %strictRulesInstalled%
25-
tags:
26-
- phpstan.rules.rule

src/Rules/PHPUnit/AssertEqualsIsDiscouragedRule.php

-13
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,13 @@
1818
class AssertEqualsIsDiscouragedRule implements Rule
1919
{
2020

21-
private bool $strictRulesInstalled;
22-
23-
public function __construct(
24-
bool $strictRulesInstalled
25-
)
26-
{
27-
$this->strictRulesInstalled = $strictRulesInstalled;
28-
}
29-
3021
public function getNodeType(): string
3122
{
3223
return NodeAbstract::class;
3324
}
3425

3526
public function processNode(Node $node, Scope $scope): array
3627
{
37-
if (!$this->strictRulesInstalled) {
38-
return [];
39-
}
40-
4128
if (!AssertRuleHelper::isMethodOrStaticCallOnAssert($node, $scope)) {
4229
return [];
4330
}

tests/Rules/PHPUnit/AssertEqualsIsDiscouragedRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testRule(): void
3232

3333
protected function getRule(): Rule
3434
{
35-
return new AssertEqualsIsDiscouragedRule(true);
35+
return new AssertEqualsIsDiscouragedRule();
3636
}
3737

3838
}

0 commit comments

Comments
 (0)