public static function infer($val, $descriptor = null, $lenient = false)
    {
        $field = new static($descriptor);
        try {
            $field->castValue($val);
        } catch (FieldValidationException $e) {
            return false;
        }
        $field->inferProperties($val, $lenient);

        return $field;
    }