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

[Serializer] backed enum throw notNormalizableValueException outside construct method #50192

Conversation

alli83
Copy link
Contributor

@alli83 alli83 commented Apr 28, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #47128 (comment)
License MIT
Doc PR

PR #47128 (comment) was aiming to throw an InvalidArgumentException if a constructor's argument is not a valid backedEnum( knowing an error will be thrown in all case e.g when it will be instantiated).

This PR aims to throw a NotNormalizableValueException (like it was the case before) if an error occurs on an BackedEnum outside the case of the first PR

So we have two different types of exceptions depending on whether it's an error at the constructor level or not.

@alli83 alli83 requested a review from dunglas as a code owner April 28, 2023 21:38
@carsonbot carsonbot added this to the 5.4 milestone Apr 28, 2023
@alli83 alli83 force-pushed the serializer-backedEnum-throw-not-normalizable-value-exception-outside-construct-method branch 2 times, most recently from 897da96 to 53fd29d Compare April 28, 2023 21:41
Copy link

@TerjeBr TerjeBr left a comment

Choose a reason for hiding this comment

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

Looks good, but missing all the data in the NotNormalizableValueException that makes it useful.

@carsonbot carsonbot changed the title Serializer backed enum throw notNormalizableValueException outside construct method [Serializer] Serializer backed enum throw notNormalizableValueException outside construct method May 2, 2023
@nicolas-grekas nicolas-grekas changed the title [Serializer] Serializer backed enum throw notNormalizableValueException outside construct method [Serializer] backed enum throw notNormalizableValueException outside construct method May 2, 2023
@alli83 alli83 force-pushed the serializer-backedEnum-throw-not-normalizable-value-exception-outside-construct-method branch from 53fd29d to 5549493 Compare May 2, 2023 16:56
Copy link

@TerjeBr TerjeBr left a comment

Choose a reason for hiding this comment

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

Looks good to me

@fabpot
Copy link
Member

fabpot commented May 5, 2023

Thank you @alli83.

@fabpot fabpot merged commit 2ca50be into symfony:5.4 May 5, 2023
11 checks passed
@fabpot fabpot mentioned this pull request May 7, 2023
This was referenced May 27, 2023
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.

None yet

6 participants