From e463c1e582e01ad6341e791ea85a58111cd5cc8b Mon Sep 17 00:00:00 2001 From: Dorian Villet Date: Wed, 9 Oct 2013 16:39:37 +0200 Subject: [PATCH] [OptionsResolver] Fix syntax errors in code examples (missing in_array closing slashes) This pull request fixes 2 syntax errors when using `in_array()` in conditions (missing the last closing slash). It also adds a missing `use` statement in one code example. --- components/options_resolver.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index d6823b5b124..5aea9f45d79 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -199,6 +199,7 @@ value you guess based on the host. You can do that easily by using a Closure as the default value:: use Symfony\Component\OptionsResolver\Options; + use Symfony\Component\OptionsResolver\OptionsResolverInterface; // ... protected function setDefaultOptions(OptionsResolverInterface $resolver) @@ -207,7 +208,7 @@ Closure as the default value:: $resolver->setDefaults(array( 'port' => function (Options $options) { - if (in_array($options['host'], array('127.0.0.1', 'localhost')) { + if (in_array($options['host'], array('127.0.0.1', 'localhost'))) { return 80; } @@ -305,7 +306,7 @@ need to use the other options for normalizing:: $resolver->setNormalizers(array( 'host' => function (Options $options, $value) { - if (!in_array(substr($value, 0, 7), array('http://', 'https://')) { + if (!in_array(substr($value, 0, 7), array('http://', 'https://'))) { if ($options['ssl']) { $value = 'https://'.$value; } else {