File tree 4 files changed +22
-3
lines changed
4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 7
7
],
8
8
"require" : {
9
9
"php" : " ^7.4 || ^8.0" ,
10
- "phpstan/phpstan" : " ^2.0"
10
+ "phpstan/phpstan" : " ^2.0.4 "
11
11
},
12
12
"conflict" : {
13
13
"phpunit/phpunit" : " <7.0"
Original file line number Diff line number Diff line change 2
2
- PHPStan\Rules\PHPUnit\AssertSameBooleanExpectedRule
3
3
- PHPStan\Rules\PHPUnit\AssertSameNullExpectedRule
4
4
- PHPStan\Rules\PHPUnit\AssertSameWithCountRule
5
- - PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule
6
5
- PHPStan\Rules\PHPUnit\ClassCoversExistsRule
7
6
- PHPStan\Rules\PHPUnit\ClassMethodCoversExistsRule
8
7
- PHPStan\Rules\PHPUnit\MockMethodCallRule
@@ -18,3 +17,10 @@ services:
18
17
deprecationRulesInstalled : %deprecationRulesInstalled%
19
18
tags :
20
19
- 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 18
18
class AssertEqualsIsDiscouragedRule implements Rule
19
19
{
20
20
21
+ private bool $ strictRulesInstalled ;
22
+
23
+ public function __construct (
24
+ bool $ strictRulesInstalled
25
+ )
26
+ {
27
+ $ this ->strictRulesInstalled = $ strictRulesInstalled ;
28
+ }
29
+
21
30
public function getNodeType (): string
22
31
{
23
32
return NodeAbstract::class;
24
33
}
25
34
26
35
public function processNode (Node $ node , Scope $ scope ): array
27
36
{
37
+ if (!$ this ->strictRulesInstalled ) {
38
+ return [];
39
+ }
40
+
28
41
if (!AssertRuleHelper::isMethodOrStaticCallOnAssert ($ node , $ scope )) {
29
42
return [];
30
43
}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public function testRule(): void
32
32
33
33
protected function getRule (): Rule
34
34
{
35
- return new AssertEqualsIsDiscouragedRule ();
35
+ return new AssertEqualsIsDiscouragedRule (true );
36
36
}
37
37
38
38
}
You can’t perform that action at this time.
0 commit comments