From 887f6f504f28e05a3b70770d35057a3e5aa6f4e4 Mon Sep 17 00:00:00 2001 From: PululuK Date: Mon, 17 Jul 2023 12:46:19 +0200 Subject: [PATCH] add `OptionsResolverIntrospector`usage doc --- components/options_resolver.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 3e7c657b79f..9c9ce53e524 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -944,3 +944,24 @@ method ``clearOptionsConfig()`` and call it periodically:: That's it! You now have all the tools and knowledge needed to process options in your code. + +Get More Insights +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The `OptionsResolverIntrospector` inspect options definitions inside an `OptionsResolver` instance. + +method:: + + use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector; + use Symfony\Component\OptionsResolver\OptionsResolver; + + $resolver = new OptionsResolver(); + $resolver->setDefaults([ + 'host' => 'smtp.example.org', + 'port' => 25, + ]); + + $introspector = new OptionsResolverIntrospector($resolver); + $introspector->getDefault('host'); // Retrieves "smtp.example.org" + +