Releases: myclabs/php-enum
Releases · myclabs/php-enum
1.6.0
07 May 06:51
Compare
Sorry, something went wrong.
No results found
Drop support for PHP 5.3 (only 5.4+ is supported)
Implement JsonSerializable interface to allow serializing the class to JSON
1.5.2
28 Jun 16:25
Compare
Sorry, something went wrong.
No results found
Remove unneeded file permissions.
1.5.1
26 Mar 10:26
Compare
Sorry, something went wrong.
No results found
Bugfix in the equals() method
Issue: #47
Pull request: #48
Contributed by @peter-gribanov
Example:
class CommandAction extends Enum
{
const EDIT = 'edit ' ;
}
class AccessRule extends Enum
{
const EDIT = 'edit ' ;
}
Expected
CommandAction::EDIT ()->equals (AccessRule::EDIT ()); // false
Actual
CommandAction::EDIT ()->equals (AccessRule::EDIT ()); // true
1.5.0
09 Oct 21:45
Compare
Sorry, something went wrong.
No results found
#4 #39 #40 : new equals() method to compare enums
$ enum = MyEnum::FOO ();
if ($ enum ->equals (MyEnum::BAR ())) {
. ..
}
It behaves the same as ==:
if ($ enum == MyEnum::BAR ()) {
. ..
}
It was added because it carries a bit more sense than == which, because it is a loose comparison, is often source of confusion (comparing objects with == is often a no-go for good reasons).
1.4.2
01 Aug 15:49
Compare
Sorry, something went wrong.
No results found
#36 , #37 Small phpdoc improvement for better autocompletion in IDEs
1.4.1
22 Jul 16:15
Compare
Sorry, something went wrong.
No results found
#21 Allow to extend the class to fetch values from somewhere else than the class constants (e.g. a database, file, …)
1.4.0
19 May 05:29
Compare
Sorry, something went wrong.
No results found
New static method values(): returns instances of the Enum class of all Enum constants (constant name in key, Enum instance in value).
MyEnum::values()
1.3.2
15 Feb 21:40
Compare
Sorry, something went wrong.
No results found
Fixed #9 Ability to create invalid enum
Fixed #13 search() is not type safe
1.3.1
03 Feb 20:44
Compare
Sorry, something went wrong.
No results found
Small performance enhancement.
1.3.0
30 Jan 22:08
Compare
Sorry, something went wrong.
No results found
A bunch of new methods were added in #5 :
$value->getKey() Returns the key of the current value on Enum
Enum::keys() Returns the names (keys) of all constants in the Enum class
Enum::isValid() Check if tested value is valid on enum set
Enum::isValidKey() Check if tested key is valid on enum set
Enum::search() Return key for searched value
The library is now PSR-4 compliant.