I need allow types that implement two interfaces (Foo and Bar), not one of them.
interface Foo {};
interface Bar {};
class Foz implements Foo {};
class Baz implements Bar {};
class Foobar implements Foo, Bar {};
$resolver = new OptionsResolver();
$resolver->setRequired('data');
$resolver->setAllowedTypes('data', ['Foo', 'Bar']);
Wrong! allows Foz and Baz instances too.
I need allow types subclass of Bar, not Bar instances.
class Bar {};
class Foobar extends Bar {};
class FoobarBaz extends Foobar {};
$resolver = new OptionsResolver();
$resolver->setRequired('data');
$resolver->setAllowedTypes('data', ['Bar']);
Wrong! allows Bar instances too.
I can redesign my classes/interfaces but it's not a design problem. So, is it possible achieve it with this component?