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

Deprecate invalid method call #11309

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

greg0ire
Copy link
Member

getAssociationMappedByTargetField() returns null when called with the owning side of an association.
This is undocumented and wrong because the phpdoc advertises a string as a return type.

Instead, callers should ensure they are calling that method with an inverse side.

Closes #11250

`getAssociationMappedByTargetField()` returns `null` when called with
the owning side of an association.
This is undocumented and wrong because the phpdoc advertises a string as
a return type.

Instead, callers should ensure they are calling that method with an
inverse side.

Closes doctrine#11250
SenseException
SenseException approved these changes Feb 25, 2024
@derrabus
Copy link
Member

Does this require a change in the persistence contracts?

@greg0ire
Copy link
Member Author

I'd say it's more like we are getting in line with the persistent contracts: they say we should always return string from that method.

Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. It's more like the contracts don't document what should be done in case of such an invalid call. Anyway, this deprecation is probably the right call here.

@greg0ire
Copy link
Member Author

Yes. We might want to look into adding native type hints to doctrine/persistence 4.0, so this kind of thing can be spotted more easily.

@greg0ire greg0ire merged commit abd9186 into doctrine:2.19.x Feb 26, 2024
58 checks passed
@greg0ire greg0ire deleted the deprecate-invalid-call branch February 26, 2024 07:45
@greg0ire greg0ire added this to the 2.19.0 milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants