public function testSetGetSetterName() { $setter = 'setSomeData'; $this->assertMethodChaining($this->object->setSetterName($setter), 'setSetterName'); $this->assertSame($setter, $this->object->getSetterName()); }
protected function setProperty($object, PropertyDefinition $property, $propertyValue) { $setterName = $property->getSetterName(); if ($setterName) { if (method_exists($object, $setterName)) { $object->{$setterName}($property->create($propertyValue)); return; } } $targetPropertyName = $property->getTargetPropertyName(); try { $reflectionProperty = $this->getReflectionProperty($targetPropertyName); $reflectionProperty->setValue($object, $property->create($propertyValue)); return; } catch (\ReflectionException $e) { } $object->{$targetPropertyName} = $property->create($propertyValue); }