Skip to content

Commit 887f6f5

Browse files
PululuKjaviereguiluz
authored andcommitted
add OptionsResolverIntrospectorusage doc
1 parent cf269d6 commit 887f6f5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

components/options_resolver.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,3 +944,24 @@ method ``clearOptionsConfig()`` and call it periodically::
944944

945945
That's it! You now have all the tools and knowledge needed to process
946946
options in your code.
947+
948+
Get More Insights
949+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
950+
951+
The `OptionsResolverIntrospector` inspect options definitions inside an `OptionsResolver` instance.
952+
953+
method::
954+
955+
use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
956+
use Symfony\Component\OptionsResolver\OptionsResolver;
957+
958+
$resolver = new OptionsResolver();
959+
$resolver->setDefaults([
960+
'host' => 'smtp.example.org',
961+
'port' => 25,
962+
]);
963+
964+
$introspector = new OptionsResolverIntrospector($resolver);
965+
$introspector->getDefault('host'); // Retrieves "smtp.example.org"
966+
967+

0 commit comments

Comments
 (0)