Skip to content

Commit 287fca2

Browse files
committed
note
1 parent 27de243 commit 287fca2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

rules/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PHPStan\Reflection\ReflectionProvider;
1515
use Rector\Doctrine\NodeAnalyzer\AttributeFinder;
1616
use Rector\PhpParser\Node\BetterNodeFinder;
17-
use Rector\PhpParser\NodeFinder\PropertyFetchFinder;
1817
use Rector\PHPUnit\Enum\PHPUnitAttribute;
1918
use Rector\PHPUnit\Enum\PHPUnitClassName;
2019
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
@@ -97,7 +96,7 @@ public function refactor(Node $node): ?Class_
9796
public function getRuleDefinition(): RuleDefinition
9897
{
9998
return new RuleDefinition(
100-
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods',
99+
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods but one, to avoid irrelevant notices in tests run',
101100
[
102101
new CodeSample(
103102
<<<'CODE_SAMPLE'
@@ -202,12 +201,14 @@ private function shouldSkipClass(Class_ $class): bool
202201
return ! $setupClassMethod instanceof ClassMethod;
203202
}
204203

205-
private function isClassMethodUsingMethodCallOnPropertyNamed(ClassMethod $classMethod, string $mockObjectPropertyName): bool
206-
{
204+
private function isClassMethodUsingMethodCallOnPropertyNamed(
205+
ClassMethod $classMethod,
206+
string $mockObjectPropertyName
207+
): bool {
207208
/** @var Node\Expr\MethodCall[] $methodCalls */
208209
$methodCalls = $this->betterNodeFinder->findInstancesOfScoped([$classMethod], [Node\Expr\MethodCall::class]);
209210
foreach ($methodCalls as $methodCall) {
210-
if (!$methodCall->var instanceof Node\Expr\PropertyFetch) {
211+
if (! $methodCall->var instanceof Node\Expr\PropertyFetch) {
211212
continue;
212213
}
213214

0 commit comments

Comments
 (0)