Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-Webfox authored and github-actions[bot] committed Feb 27, 2023
1 parent 15321a2 commit bbd5d25
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

All notable changes to `laravel-backed-enums` will be documented in this file.

## Add support for direct value comparisons - 2023-02-27

Right now if you want to use `->isA` or `->isAny` or the other comparison methods you must pass in an enum instance, I.e.

```php
$user->role->isA(MyEnum::from('admin')); // true
$user->role->isA('admin'); // false

$user->role->isA(MyEnum::from('not-a-value')); // exception
$user->role->isA('not-a-value'); // false

$user->role->isAny([MyEnum::from('admin')]); // true
$user->role->isAny(['admin']); // false

$user->role->isAny([MyEnum::from('not-a-value')]); // exception
$user->role->isAny(['not-a-value']); // false

```
This release makes it so each pair of methods will act the same whether given a string value or an enum instance.

```php
$user->role->isA(MyEnum::from('admin')); // true
$user->role->isA('admin'); // true

$user->role->isA(MyEnum::from('not-a-value')); // exception
$user->role->isA('not-a-value'); // exception

$user->role->isAny([MyEnum::from('admin')]); // true
$user->role->isAny(['admin']); // true

$user->role->isAny([MyEnum::from('not-a-value')]); // exception
$user->role->isAny(['not-a-value']); // exception

```
This also applies for isAn, isNotA, isNotAn, isNotAny

## v1.2.1 - 2023-02-22

### What's Changed
Expand Down

0 comments on commit bbd5d25

Please sign in to comment.