I need permission types that implement two interfaces ( Foo and Bar ), and 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! also allows instances of Foz and Baz .
I need to allow subclass types 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 instances of Bar .
I can redesign my classes / interfaces, but this is not a design issue. So, can this be achieved with this component?
source share