From abb51892ec67fbcfd854d088adf30c04b712eb50 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 5 Oct 2018 14:06:22 -0400 Subject: [PATCH] Documenting Options argument for closure deprecation func --- components/options_resolver.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index c731ae7dc45..87829813b17 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -660,13 +660,19 @@ This closure is useful to only deprecate some of the allowed types or values of the option:: $resolver + ->setDefault('encryption', null) ->setDefault('port', null) ->setAllowedTypes('port', array('null', 'int')) - ->setDeprecated('port', function ($value) { + ->setDeprecated('port', function (Options $options, $value) { if (null === $value) { return 'Passing "null" to option "port" is deprecated, pass an integer instead.'; } + // deprecation may also depend on another option + if ('ssl' === $options['encryption'] && 456 !== $value) { + return 'Passing a different port than "456" when the "encryption" option is set to "ssl" is deprecated.'; + } + return ''; }) ;