1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Tests\Fixtures; 6 7use JMS\Serializer\Annotation as Serializer; 8use JMS\Serializer\Context; 9use JMS\Serializer\Metadata\PropertyMetadata; 10 11class PersonSecretWithVariables 12{ 13 /** 14 * @Serializer\Type("string") 15 */ 16 public $name; 17 18 /** 19 * @Serializer\Type("string") 20 * @Serializer\Expose(if="context.getDirection()==2 || object.test(property_metadata, context)") 21 */ 22 public $gender; 23 24 public function test(PropertyMetadata $propertyMetadata, Context $context) 25 { 26 return true; 27 } 28} 29