protected function castString(string $value)
    {
        $val = trim($value);

        if (!is_numeric($val) && $val !== '') {
            return $this->dontCast($value);
        }

        $type = strpos($this->type, '|') !== false ? (strpos($val, '.') !== false ? 'float' : 'integer') : $this->type;
        settype($val, $type);

        return $val;
    }
protected function castString(string $value)
    {
        $val = trim($value);

        if (!is_numeric($val) && $val !== '') {
            return $this->dontCast($value);
        }

        $type = strpos($this->type, '|') !== false ? (strpos($val, '.') !== false ? 'float' : 'integer') : $this->type;
        settype($val, $type);

        return $val;
    }
protected function castString ( string $ value ) { $ val = trim ( $ value ) ; if ( ! is_numeric ( $ val ) && $ val !== '' ) { return $ this -> dontCast ( $ value ) ; } $ type = strpos ( $ this -> type , '|' ) !== false ? ( strpos ( $ val , '.' ) !== false ? 'float' : 'integer' ) : $ this -> type ; settype ( $ val , $ type ) ; return $ val ; }
Cast a string to a number

@param string $value
@return int|float|string
Cast a string to a number