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

Fail nicely on enum FQCNs #90

Merged
merged 1 commit into from Mar 3, 2022

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Mar 2, 2022

When being presented with an enum FQCN, the Instantiator currently tries to create an instance via reflection and triggers an Error. This PR turns this error into a nice Doctrine\Instantiator\Exception\InvalidArgumentException which is the same exception we already get for interfaces, traits and abstract classes.

An alternative could be to simply return the first case of the enum. The problem with that approach is that the instantiator currently guarantees that each call will yield a different instance. That wouldn't be the case for enums then.

@derrabus derrabus added the bug label Mar 2, 2022
@derrabus derrabus added this to the 1.4.1 milestone Mar 2, 2022
@derrabus derrabus merged commit 10dcfce into doctrine:1.4.x Mar 3, 2022
@derrabus derrabus deleted the improvement/fail-on-enum branch March 3, 2022 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants