/** * @Mapped(type="string") */ public $propertyThree; } $donator = ['priceOut' => '1000.51000', 'count' => 100, 'array' => ['1.222', '2.333', '3.400000'], 'object' => [['propertyOne' => '1000.500', 'propertyTwo' => '2000.500', 'propertyThree' => ' aaaddd ']]]; $example = new Example(); $example->mapping($donator); var_dump($example); $donator = new stdClass(); $donator->priceOut = '2000.52000'; $donator->count = 200; $donator->array = [4, 5, 6]; $donator->object = [['propertyOne' => '1000.520', 'propertyTwo' => '2000.520', 'propertyThree' => ' aaaddd ']]; $example = new Example(); $example->mapping($donator); var_dump($example); // Set default precision for all properties with float type \Alexboo\AnnotationMapper\Cast\Float::setDefaultPrecision(1); class Example3 extends \Alexboo\AnnotationMapper\Mapper { /** * @var float $field1 * @Mapped(type="float") */ public $field1; /** * @var float $field2 * @Mapped(type="float") */ public $field2;