1<?php 2 3namespace Drupal\Core\TypedData\Plugin\DataType; 4 5use Drupal\Core\TypedData\PrimitiveBase; 6use Drupal\Core\TypedData\Type\FloatInterface; 7 8/** 9 * The float data type. 10 * 11 * The plain value of a float is a regular PHP float. For setting the value 12 * any PHP variable that casts to a float may be passed. 13 * 14 * @DataType( 15 * id = "float", 16 * label = @Translation("Float") 17 * ) 18 */ 19class FloatData extends PrimitiveBase implements FloatInterface { 20 21 /** 22 * {@inheritdoc} 23 */ 24 public function getCastedValue() { 25 return (float) $this->value; 26 } 27 28} 29