marc-mabe / php-enum

Simple and fast implementation of enumerations with native PHP
BSD 3-Clause "New" or "Revised" License
464 stars 36 forks source link

mv Enum::getBy[Name|Ordinal]() to Enum::by[Name|Ordinal]() & add Enum::byValue() #80

Closed marc-mabe closed 7 years ago

marc-mabe commented 7 years ago

This is just for consistency to differ the methods of getting something out of an enumeration/set/enumerator using get*() with the methods for accessing an enumerator (Enum::by*()).

The method Enum::get($valueOrInstance) still exists but I added the method Enum::byValue($value) which doesn't allow an already instantiated enumerator as argument. -> So for consistency the method Enum::get($valueOrInstance) doesn't really follow this naming but calling it something like byValueOrInstance sounds stange to me and also this is a widely used method that I wouldn't like to rename.

@prolic Do you think this makes sense even with the given BC later on removing deprecated methods?