Skip to content

1.5.0

Compare
Choose a tag to compare
@mnapoli mnapoli released this 09 Oct 21:45
· 173 commits to master since this release

#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).