Assert\Assertion::float PHP Method

float() public static method

Assert that value is a php float.
public static float ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
return boolean
    public static function float($value, $message = null, $propertyPath = null)
    {
        if (!is_float($value)) {
            $message = sprintf($message ?: 'Value "%s" is not a float.', static::stringify($value));
            throw static::createException($value, $message, static::INVALID_FLOAT, $propertyPath);
        }
        return true;
    }

Usage Example

Exemplo n.º 1
0
 public function customMetric($metricName, $value)
 {
     Assertion::string($metricName);
     Assertion::notBlank($metricName);
     Assertion::float($value);
     return $this->handle('newrelic_custom_metric', [$metricName, $value]);
 }
All Usage Examples Of Assert\Assertion::float