-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix MissingConstructorArgumentsException returning missing argument one by one #49832
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] Fix MissingConstructorArgumentsException returning missing argument one by one #49832
Conversation
/cc @HypeMC FYI |
/cc @BafS also |
The original goal of my PR was to add the class as an argument to the exception, this reverts that as well. While I like the idea of having all the arguments at once, I don't see why the part with the class being passed needs to be removed. |
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Outdated
Show resolved
Hide resolved
Well, sorry, I missed that part I'll check that. |
ada843a
to
5dc7445
Compare
I have a failing test locally and I think that it's fine as it requires now a constructor parameter that is missing but I'm not sure if I might fix it (ie I actually broke a thing). It's at src/Symfony/Component/Serializer/Tests/SerializerTest.php:764 details :
|
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentsException.php
Outdated
Show resolved
Hide resolved
371daec
to
8998701
Compare
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/Normalizer/AbstractNormalizer.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
src/Symfony/Component/Serializer/Exception/MissingConstructorArgumentException.php
Outdated
Show resolved
Hide resolved
1ff6b4a
to
0f3622a
Compare
…ng argument one by one
e1b891c
to
43d028d
Compare
Thank you @ktherage. |
… 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
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.