Skip to content

Commit

Permalink
use conditionalTags
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 13, 2024
1 parent f91d89e commit 9f1c63a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
8 changes: 4 additions & 4 deletions rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ rules:
- PHPStan\Rules\PHPUnit\NoMissingSpaceInMethodAnnotationRule
- PHPStan\Rules\PHPUnit\ShouldCallParentMethodsRule

conditionalTags:
PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule:
phpstan.rules.rule: [%strictRulesInstalled%, %featureToggles.bleedingEdge%]

services:
-
class: PHPStan\Rules\PHPUnit\DataProviderDeclarationRule
Expand All @@ -20,7 +24,3 @@ services:

-
class: PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule
arguments:
strictRulesInstalled: %strictRulesInstalled%
tags:
- phpstan.rules.rule
13 changes: 0 additions & 13 deletions src/Rules/PHPUnit/AssertEqualsIsDiscouragedRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,13 @@
class AssertEqualsIsDiscouragedRule implements Rule
{

private bool $strictRulesInstalled;

public function __construct(
bool $strictRulesInstalled
)
{
$this->strictRulesInstalled = $strictRulesInstalled;
}

public function getNodeType(): string
{
return NodeAbstract::class;
}

public function processNode(Node $node, Scope $scope): array
{
if (!$this->strictRulesInstalled) {
return [];
}

if (!AssertRuleHelper::isMethodOrStaticCallOnAssert($node, $scope)) {
return [];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Rules/PHPUnit/AssertEqualsIsDiscouragedRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testRule(): void

protected function getRule(): Rule
{
return new AssertEqualsIsDiscouragedRule(true);
return new AssertEqualsIsDiscouragedRule();
}

}

0 comments on commit 9f1c63a

Please sign in to comment.