This pull request improves the extensibility of EnumTransformer.
Currently, EnumCollector is directly tied to EnumTransformer, which means that if we want to override the later, we also need to override the former.
With this pull request, the EnumCollector will check if there is a transformer that extends EnumTransformer instead of checking if EnumTransformer exists at all.
Additionally, the verification logic has been extracted to a method so it can be overridden if necessary.
This pull request improves the extensibility of
EnumTransformer
.Currently,
EnumCollector
is directly tied toEnumTransformer
, which means that if we want to override the later, we also need to override the former.With this pull request, the
EnumCollector
will check if there is a transformer that extendsEnumTransformer
instead of checking ifEnumTransformer
exists at all.Additionally, the verification logic has been extracted to a method so it can be overridden if necessary.
The use case for this is the same as https://github.com/spatie/laravel-data/pull/589