public function testCreateWhenPropertyIsNotNullableAndHasntDefaultValue() { $this->assertSame('', $this->object->create(null)); $this->assertSame('perfect jump', $this->object->create('perfect jump')); }
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); }