-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Replace the MissingConstructorArgumentsException class with MissingConstructorArgumentException #49013
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
Merged
nicolas-grekas
merged 1 commit into
symfony:6.3
from
HypeMC:class-in-missingconstructorargumentsexception
Feb 23, 2023
Merged
[Serializer] Replace the MissingConstructorArgumentsException class with MissingConstructorArgumentException #49013
nicolas-grekas
merged 1 commit into
symfony:6.3
from
HypeMC:class-in-missingconstructorargumentsexception
Feb 23, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
072aa3a
to
0d606a6
Compare
OskarStark
reviewed
Jan 17, 2023
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
mtarld
requested changes
Jan 20, 2023
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
73490be
to
f03c264
Compare
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
MissingConstructorArgumentsException
6e090a0
to
93abdbb
Compare
nicolas-grekas
approved these changes
Jan 26, 2023
…ith MissingConstructorArgumentException
93abdbb
to
b377c12
Compare
Thank you @HypeMC. |
nicolas-grekas
added a commit
that referenced
this pull request
Apr 21, 2023
…rning missing argument one by one (ktherage) This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Serializer] Fix MissingConstructorArgumentsException returning missing argument one by one | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR is an improvment of #49013 and fix #42712. She aims to fix the problem reported in #49013 indicating that the method `getMissingConstructorArguments()` of `\Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException` class introduced in #42712 is returning only one missing arguments when there's more than one missing. Commits ------- 43d028d [Serializer] Fix MissingConstructorArgumentsException returning missing argument one by one
Merged
nicolas-grekas
added a commit
that referenced
this pull request
Oct 17, 2023
… argument (HypeMC) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Serializer] Fix collecting only first missing constructor argument | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT Alternative to #51866, sort of followup to #49832 Currently on 5.4 only the first exception is added to the `not_normalizable_value_exceptions` array when `COLLECT_DENORMALIZATION_ERRORS` is `true` or only the first argument is mentioned in the `MissingConstructorArgumentsException` when it is `false`. On 6.3 however, the part with the `MissingConstructorArgumentsException` was fix with #49832, but the part with the `not_normalizable_value_exceptions` was overlooked. IMO this is inconsistent behavior as the two cases are actually the same thing with the only difference being that in one case an exception is thrown while in the other the errors are collected. I'm not sure if #51866 really qualifies as a bug or is actually more a feature, but the reason #49832 was merged onto 6.3 was because of the changes originally done in #49013, which itself was a feature. If #51866 does qualify as a bug then it would make sense to backport #49832 to 5.4 for consistency, which is what this PR does. The PR contains two commits: 1) backport of #49832 2) alternative to #51866 If #51866 does not qualify as a bug, the first commit can be drooped and the second one can be rebased with 6.4. PS I think it's easier to review the changes commit by commit. Commits ------- 0f398ce [Serializer] Fix collecting only first missing constructor argument
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Followup to #42712.
Currently only the missing arguments are saved in the
MissingConstructorArgumentsException
, so there's no way of knowing which class is missing those arguments when nested objects are being deserialized. This PR adds this information to the exception.Also, while working on this I've noticed that the
$missingArguments
argument accepts an array of missing arguments, but only one is ever passed. I'm not sure if this was done intentionally or by accident, but I've changed it so that only one is expected. Please let me know if this change is ok.UPDATE:
I've added a new
MissingConstructorArgumentException
class which accepts only one argument and the class name and deprecated theMissingConstructorArgumentsException
class. However, since the main goal of this PR is to add the class to the exception, I can revert the renaming part if you think the change is not worth it.