[TypeDeclaration] Clean up get ClassReflection on loop on TypedPropertyFromCreateMockAssignRector#6181
Conversation
|
All checks have passed 🎉 @TomasVotruba it is ready for review. |
|
I cleaned up ClassReflection usage only on |
|
All checks have passed 🎉 @TomasVotruba I think it is ready. |
|
|
||
| $type = $this->allAssignNodePropertyTypeInferer->inferProperty( | ||
| $propertyName = (string) $this->getName($property); | ||
| $type = $this->assignToPropertyTypeInferer->inferPropertyInClassLike( |
There was a problem hiding this comment.
Thanks 👍
The assignToPropertyTypeInferer should be removed as well, to avoid checking all the possible types and assigns.
This rule should be as simple as possible.
There was a problem hiding this comment.
if no check on the assignments on other methods, then, reset on other method will cause error, as it can't detect nullability, this ensure nullability or reset by other type applied,eg:
protected function setUp()
{
$this->a = $this->createMock(Foo::class);
}
protected function reset()
{
$this->a = null;
}if we check only on setUp(), that will cause it only detect as MockObject, which wrong
There was a problem hiding this comment.
the only apply MockObject or ?MockObject verify already checked on later line 121 on this PR or 133 on main branch
There was a problem hiding this comment.
I added test for skip with non-mock object type, eg: skip string 298f24c
There was a problem hiding this comment.
I see, let's go with this version for now then. Thanks 👍
per review on #6179 (review)