Skip to content

[OptionsResolver] wrong exception hierarchy #10585

@Tobion

Description

@Tobion

I think the exceptions are defined wrong because they don't respect the meaning of runtime vs logic exception.

  • OptionDefinitionException is obviously a logic exception because it happens with a code problem and should extend \BadMethodCallException
  • InvalidOptionsException (as thrown by resolve()) is a runtimeexception and should extend \UnexpectedValueException
  • MissingOptionsException is also runtimeexception and should extend \UnexpectedValueException
  • setAllowedValues() and similar run validateOptionsExistence() and also throw a InvalidOptionsException. Instead it should be a OptionDefinitionException because its a code problem when defining options and not a runtime exception.
  • OptionsResolverInterface::setNormalizers is missing an @throws

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