-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main , >=2.0.12 |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/926cc603-8eae-41c4-b106-37deb23ffbb5
Rule TypedPropertyFromCreateMockAssignRector replaces exact type (MockObject + mocked class) for property with a generic type.
<?php
namespace Whatever\Tests;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Whatever\SomeClass;
final class SomeTest extends TestCase
{
private MockObject&SomeClass $someProperty;
protected function setUp(): void
{
$this->someProperty = $this->createMock(SomeClass::class);
}
}Responsible rules
TypedPropertyFromCreateMockAssignRector
Expected Behavior
There is no need to change to code: declared type includes MockObject
Reactions are currently unavailable