Instead of the switch, you can do:

```
if ($type->getOptionsResolver()->isKnown('max_length')) {
```