-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #51907 [Serializer] Fix collecting only first missing constructor…
… 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
- Loading branch information
Showing
5 changed files
with
161 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
35 changes: 35 additions & 0 deletions
35
src/Symfony/Component/Serializer/Tests/Fixtures/WithTypedConstructor.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Serializer\Tests\Fixtures; | ||
|
||
final class WithTypedConstructor | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $string; | ||
/** | ||
* @var bool | ||
*/ | ||
public $bool; | ||
/** | ||
* @var int | ||
*/ | ||
public $int; | ||
|
||
public function __construct(string $string, bool $bool, int $int) | ||
{ | ||
$this->string = $string; | ||
$this->bool = $bool; | ||
$this->int = $int; | ||
} | ||
} |
This file contains 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
This file contains 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