Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Documenting Options argument for closure deprecation func
  • Loading branch information
yceruto committed Oct 10, 2018
commit abb51892ec67fbcfd854d088adf30c04b712eb50
8 changes: 7 additions & 1 deletion components/options_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
})
;
Expand Down