diff --git a/rules-tests/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector/Fixture/skip_property_as_can_be_defined_multiple_times.php.inc b/rules-tests/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector/Fixture/skip_property_as_can_be_defined_multiple_times.php.inc new file mode 100644 index 00000000..60aad890 --- /dev/null +++ b/rules-tests/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector/Fixture/skip_property_as_can_be_defined_multiple_times.php.inc @@ -0,0 +1,21 @@ +someClass = $this->createMock(\stdClass::class); + } + + public function test(): void + { + $this->someClass->method('some'); + } +} diff --git a/rules/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector.php b/rules/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector.php index 7ae04e76..d6b417af 100644 --- a/rules/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector.php +++ b/rules/PHPUnit120/Rector/MethodCall/ExplicitMockExpectsCallRector.php @@ -7,7 +7,6 @@ use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\MethodCall; -use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\Variable; use PHPStan\Type\ObjectType; use Rector\PHPStan\ScopeFetcher; @@ -87,7 +86,7 @@ public function refactor(Node $node): Node|null return null; } - if (! $node->var instanceof Variable && ! $node->var instanceof PropertyFetch) { + if (! $node->var instanceof Variable) { return null; }