-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Component][Serializer][Normalizer] : Deal it with Has Method for the Normalizer/Denormalizer #23337
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
Conversation
@Aliance , I stole you this mini practice to exercise my Symfony PR ;-) (I'm a newbie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix! I left some minor comments.
@@ -497,6 +497,23 @@ public function testPrivateSetter() | |||
$this->assertEquals('bar', $obj->getFoo()); | |||
} | |||
|
|||
public function testHasGetterDenormalize() | |||
{ | |||
$obj = $this->normalizer->denormalize(array('foo' => true), __NAMESPACE__.'\ObjectWithHasGetterDummy'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use ObjectWithHasGetterDummy::class
public function testHasGetterDenormalize() | ||
{ | ||
$obj = $this->normalizer->denormalize(array('foo' => true), __NAMESPACE__.'\ObjectWithHasGetterDummy'); | ||
$this->assertEquals(true, $obj->hasFoo()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->assertTrue($obj->hasFoo())
|
||
class ObjectWithHasGetterDummy | ||
{ | ||
private $foo = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= null
is useless, it's the default value.
… Normalizer/Denormalizer
@dunglas , you can check :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase should be done right before merging, not while code review. Otherwise reviewers can not see only made changes.
Thank you @jordscream. |
… Method for the Normalizer/Denormalizer (jordscream) This PR was merged into the 3.4 branch. Discussion ---------- [Component][Serializer][Normalizer] : Deal it with Has Method for the Normalizer/Denormalizer | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | ? | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23314 | License | MIT | Doc PR | symfony/symfony-docs Deal it with Has Method for the Normalizer/Denormalizer Commits ------- a15829d [Component][Serializer][Normalizer] : Deal it with Has Method for the Normalizer/Denormalizer
Deal it with Has Method for the Normalizer/Denormalizer