Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #15426 [Serializer] Add support for variadic arguments in the Get…
…SetNormalizer (stof) This PR was merged into the 2.3 branch. Discussion ---------- [Serializer] Add support for variadic arguments in the GetSetNormalizer | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a There were 2 broken cases: - when the value was passed, the array was passed as argument, becoming the first value of the variadic array. The array needs to be spread into multiple arguments when calling the method - when the value was missing, the code would throw a ReflectionException, similar to the issue reported in #13690, because a variadic argument is optional but does not have a default value Commits ------- 704760b Add support for variadic arguments in the GetSetNormalizer
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 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
27 changes: 27 additions & 0 deletions
27
src/Symfony/Component/Serializer/Tests/Fixtures/VariadicConstructorArgsDummy.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,27 @@ | ||
<?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; | ||
|
||
class VariadicConstructorArgsDummy | ||
{ | ||
private $foo; | ||
|
||
public function __construct(...$foo) | ||
{ | ||
$this->foo = $foo; | ||
} | ||
|
||
public function getFoo() | ||
{ | ||
return $this->foo; | ||
} | ||
} |
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