Skip to content

[OptionsResolver] Normalizers should not be applied for missing options #9174

Closed
@webmozart

Description

@webmozart

See #6215 and #6233.

When running

$resolver->setOptional(array('foo'));
$resolver->setNormalizers(array(
    'foo' => function (Options $options, $previousValue) {
        return doSomethingWith($previousValue);
    },
));

$options = $resolver->resolve(array());

then the normalizer is currently executed even though the option is missing. Since there is a test that asserts this behavior, we can't change it without breaking BC.

In Symfony 3.0, normalizers should not be executed for missing options.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions