Skip to content
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 AssociationMapping type #355

Merged
merged 4 commits into from
Aug 8, 2022

Conversation

VincentLanglet
Copy link
Contributor

Hi @ondrejmirtes, I was trying the doctrine/orm 2.13.x branch, after the merge of doctrine/orm#9794
And I'm getting a log of

Access to offset 'isOwningSide' on an unknown class Doctrine\ORM\Mapping\AssociationMapping.

Seems like it's because the type is not defined in the stub. When I modified my vendor, it fixed the issue.

@VincentLanglet
Copy link
Contributor Author

VincentLanglet commented Aug 6, 2022

I updated the type following the PR doctrine/orm#9965

This seems pretty annoying having to copy paste all changes from orm here.

I think the best would be to "fix" phpstan in order to be able to understand the type defined in the original class, even if it was re-declared in the stub. (Especially here because the type are not used in the stub)
Any idea if it's possible ?

I reproduce the error here: sonata-project/EntityAuditBundle#503

@VincentLanglet
Copy link
Contributor Author

I think the best would be to "fix" phpstan in order to be able to understand the type defined in the original class, even if it was re-declared in the stub. (Especially here because the type are not used in the stub) Any idea if it's possible ?

I found the issue.

As soon as the stub has a some class phpdoc (I reproduced with @phpstan-type but I think it can occur with some other tags), it override all the types declared in the original class. A reproducer can be found here:
phpstan/phpstan-src#1603

@ondrejmirtes ondrejmirtes merged commit a6edbb0 into phpstan:1.3.x Aug 8, 2022
@ondrejmirtes
Copy link
Member

Thank you.

@VincentLanglet
Copy link
Contributor Author

You're welcome. If you have time for a release, it would help me a lot until a solution is found for phpstan/phpstan#7755 :)

@VincentLanglet VincentLanglet deleted the AssociationMapping branch August 8, 2022 17:42
@ondrejmirtes
Copy link
Member

The build is failing and I need to investigate it - if it's a bug or if it's a consequence of your change and I can remove some asserts.

@VincentLanglet
Copy link
Contributor Author

I see. I'll tried to take a look.

For the record my PR just copied-pasted the types from doctrine/orm. So if there is an error in the type, I'll need to do the pr on doctrine/orm too ^^

@VincentLanglet
Copy link
Contributor Author

I just check and it seems you can indeed remove a lot of assert/phpdoc/cast.
I opened #359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants