Fixed explicitly ignores a depreciation
This commit is contained in:
parent
8c24c35fe8
commit
8398947c9c
@ -801,7 +801,7 @@ class OptionsResolver implements Options
|
||||
|
||||
// Shortcut for resolved options
|
||||
if (array_key_exists($option, $this->resolved)) {
|
||||
if ($triggerDeprecation && isset($this->deprecated[$option]) && \is_string($this->deprecated[$option])) {
|
||||
if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option])) {
|
||||
@trigger_error(strtr($this->deprecated[$option], array('%name%' => $option)), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
|
@ -754,6 +754,9 @@ class OptionsResolverTest extends TestCase
|
||||
yield 'It explicitly ignores a depreciation' => array(
|
||||
function (OptionsResolver $resolver) {
|
||||
$resolver
|
||||
->setDefault('baz', function (Options $options) {
|
||||
return $options->offsetGet('foo', false);
|
||||
})
|
||||
->setDefault('foo', null)
|
||||
->setDeprecated('foo')
|
||||
->setDefault('bar', function (Options $options) {
|
||||
|
Reference in New Issue
Block a user