允许空字符串以及指定的验证断言

So I'm using Symfony validation to make sure a posted field is within the given range. I also want to allow empty string values in this field, for example if the user does not supply any data.

'somePostedField' => [
    new Assert\Optional(
        new Assert\Range([
            'min'        => 0.01,
            'max'        => 100,
            'minMessage' => 'tooShort',
            'maxMessage' => 'tooLong',
            'invalidMessage' => 'invalid',
        ])
    )
],

You'd think the Optional assertion would do the trick, but that just ignores the rules for the field if it is not present in the data when validating.

How do I also allow empty strings in this field?