When being presented with an enum FQCN, the Instantiator currently tries to create an instance via reflection and triggers an Error. This PR turns this error into a nice Doctrine\Instantiator\Exception\InvalidArgumentException which is the same exception we already get for interfaces, traits and abstract classes.
An alternative could be to simply return the first case of the enum. The problem with that approach is that the instantiator currently guarantees that each call will yield a different instance. That wouldn't be the case for enums then.
When being presented with an enum FQCN, the
Instantiator
currently tries to create an instance via reflection and triggers anError
. This PR turns this error into a niceDoctrine\Instantiator\Exception\InvalidArgumentException
which is the same exception we already get for interfaces, traits and abstract classes.An alternative could be to simply return the first case of the enum. The problem with that approach is that the instantiator currently guarantees that each call will yield a different instance. That wouldn't be the case for enums then.