File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -305,19 +305,20 @@ correctly. To validate the types of the options, call
305
305
306
306
// specify multiple allowed types
307
307
$resolver->setAllowedTypes('port', ['null', 'int']);
308
- // which is similar to
308
+ // if you prefer, you can also use the following equivalent syntax
309
309
$resolver->setAllowedTypes('port', 'int|null');
310
310
311
311
// check all items in an array recursively for a type
312
312
$resolver->setAllowedTypes('dates', 'DateTime[]');
313
313
$resolver->setAllowedTypes('ports', 'int[]');
314
+ // the following syntax means "an array of integers or an array of strings"
314
315
$resolver->setAllowedTypes('endpoints', '(int|string)[]');
315
316
}
316
317
}
317
318
318
319
.. versionadded :: 7.3
319
320
320
- Union of type, using the ``| `` syntax, was introduced in Symfony 7.3.
321
+ Defining type unions with the ``| `` syntax was introduced in Symfony 7.3.
321
322
322
323
You can pass any type for which an ``is_<type>() `` function is defined in PHP.
323
324
You may also pass fully qualified class or interface names (which is checked
You can’t perform that action at this time.
0 commit comments