Skip to content

Commit 5cf9008

Browse files
committed
minor #18571 add OptionsResolverIntrospectorusage doc (PululuK)
This PR was submitted for the 6.4 branch but it was squashed and merged into the 5.4 branch instead. Discussion ---------- add `OptionsResolverIntrospector`usage doc <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Original commit : symfony/symfony@d6d187d Orignal PR : symfony/symfony#24208 Commits ------- 887f6f5 add `OptionsResolverIntrospector`usage doc
2 parents cf269d6 + 887f6f5 commit 5cf9008

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)