dbalabka / php-enumeration

Implementation of enumeration classes in PHP. The better alternative for enums
MIT License
53 stars 4 forks source link

interface StaticConstructorInterface seems redundant #14

Closed githoober closed 4 years ago

githoober commented 5 years ago

interface StaticConstructorInterface seems to be redundant as it's only implemented by the Enumeration class and there are neither any other classes in the library nor anything in userland code that will be implementing it.

Removing it does not break anything, but simplifies the library code. Not removing it may lead to non-related classes being loaded statically in composer which is not a responsibility of this library.

dbalabka commented 5 years ago

interface StaticConstructorInterface seems to be redundant as it's only implemented by the Enumeration class and there are neither any other classes in the library nor anything in userland code that will be implementing it.

StaticConstructorInterface is a part of static constructor functionality required to integrate with the composer autoloader (see StaticConstructorLoader). I can replace is_a() with method_exists and void interface usage, but IMO interface is a more explicit way.

Removing it does not break anything, but simplifies the library code. Not removing it may lead to non-related classes being loaded statically in composer which is not a responsibility of this library.

Currently, static constructor loader is a part of enumeration library but can be moved into separate library w/o BC breaks. But anyway the enumeration library will suggest to install it. Also, this library should not load any additional classes. If you spot the problem please describe more detailedly.

dbalabka commented 4 years ago

I close this ticket because original question is answered