File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 77 ],
88 "require" : {
99 "php" : " ^7.4 || ^8.0" ,
10- "phpstan/phpstan" : " ^2.0"
10+ "phpstan/phpstan" : " ^2.0.4 "
1111 },
1212 "conflict" : {
1313 "phpunit/phpunit" : " <7.0"
Original file line number Diff line number Diff line change 22 - PHPStan\Rules\PHPUnit\AssertSameBooleanExpectedRule
33 - PHPStan\Rules\PHPUnit\AssertSameNullExpectedRule
44 - PHPStan\Rules\PHPUnit\AssertSameWithCountRule
5- - PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule
65 - PHPStan\Rules\PHPUnit\ClassCoversExistsRule
76 - PHPStan\Rules\PHPUnit\ClassMethodCoversExistsRule
87 - PHPStan\Rules\PHPUnit\MockMethodCallRule
@@ -18,3 +17,10 @@ services:
1817 deprecationRulesInstalled : %deprecationRulesInstalled%
1918 tags :
2019 - phpstan.rules.rule
20+
21+ -
22+ class : PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule
23+ arguments :
24+ strictRulesInstalled : %strictRulesInstalled%
25+ tags :
26+ - phpstan.rules.rule
Original file line number Diff line number Diff line change 1818class 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+
2130 public function getNodeType (): string
2231 {
2332 return NodeAbstract::class;
2433 }
2534
2635 public function processNode (Node $ node , Scope $ scope ): array
2736 {
37+ if (!$ this ->strictRulesInstalled ) {
38+ return [];
39+ }
40+
2841 if (!AssertRuleHelper::isMethodOrStaticCallOnAssert ($ node , $ scope )) {
2942 return [];
3043 }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public function testRule(): void
3232
3333 protected function getRule (): Rule
3434 {
35- return new AssertEqualsIsDiscouragedRule ();
35+ return new AssertEqualsIsDiscouragedRule (true );
3636 }
3737
3838}
You can’t perform that action at this time.
0 commit comments