-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add self reference test case for DoctrineTargetEntityStringToClassConstantRector #211
Conversation
1d62860
to
0d58d4e
Compare
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
final class KeepSelfReference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the #[Entity]
Attribute here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, just added 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking other fixtures, it's actually not needed. This rules checks directly these annotations/attributes.
There already is another test fixture for self::class
as well 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add:
#[ORM\JoinColumn(name: 'some_entity', onDelete: 'SET NULL')
from my screenshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah the difference is, in your existing test you use private ?self.....
while here is no type hint.
Please do:
- private $someEntity;
+ private KeepSelfReference $someEntity;
if this does not work, try to make it nullable:
- private $someEntity;
+ private ?KeepSelfReference $someEntity;
8cb00ab
to
df902fe
Compare
df902fe
to
c977a6a
Compare
@TomasVotruba @OskarStark it already resolved in PR: please use rector dev-main |
Thanks 👍 |
Test fixture for rectorphp/rector#8081