File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -842,6 +842,29 @@ the option::
842
842
This closure receives as argument the value of the option after validating it
843
843
and before normalizing it when the option is being resolved.
844
844
845
+ Ignore not defined Options
846
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
847
+
848
+ By default, all options are resolved, validated and an :class: `Symfony\\ Component\\ OptionsResolver\\ Exception\\ UndefinedOptionsException `
849
+ is thrown if an unknown option is passed. You can ignore not defined options by using the
850
+ :method: `Symfony\\ Component\\ OptionsResolver\\ OptionsResolver::ignoreUndefined ` method::
851
+
852
+ // ...
853
+ $resolver
854
+ ->setDefined(['hostname'])
855
+ ->setIgnoreUndefined(true)
856
+ ;
857
+
858
+ // option "version" will be ignored
859
+ $resolver->resolve([
860
+ 'hostname' => 'acme/package',
861
+ 'version' => '1.2.3'
862
+ ]);
863
+
864
+ .. versionadded :: 6.3
865
+
866
+ The ``ignoreUndefined `` method was introduced in Symfony 6.3.
867
+
845
868
Chaining Option Configurations
846
869
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
847
870
You can’t perform that action at this time.
0 commit comments