Skip to content

Commit 7023a3b

Browse files
authored
skip property fetch (#624)
1 parent 27a5607 commit 7023a3b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\PHPUnit120\Rector\MethodCall\ExplicitMockExpectsCallRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
final class SkipPropertyAsCanBeDefinedMultipleTimes extends TestCase
8+
{
9+
10+
private \PHPUnit\Framework\MockObject\MockObject $someClass;
11+
12+
protected function setUp(): void
13+
{
14+
$this->someClass = $this->createMock(\stdClass::class);
15+
}
16+
17+
public function test(): void
18+
{
19+
$this->someClass->method('some');
20+
}
21+
}

rules/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node;
88
use PhpParser\Node\Arg;
99
use PhpParser\Node\Expr\MethodCall;
10-
use PhpParser\Node\Expr\PropertyFetch;
1110
use PhpParser\Node\Expr\Variable;
1211
use PHPStan\Type\ObjectType;
1312
use Rector\PHPStan\ScopeFetcher;
@@ -87,7 +86,7 @@ public function refactor(Node $node): Node|null
8786
return null;
8887
}
8988

90-
if (! $node->var instanceof Variable && ! $node->var instanceof PropertyFetch) {
89+
if (! $node->var instanceof Variable) {
9190
return null;
9291
}
9392

0 commit comments

Comments
 (0)