Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Comparable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
use Exception;
use Iterator;
use IteratorAggregate;
use UnitEnum;

trait Comparable
{
public function is(mixed $enum): bool
public function is(UnitEnum $enum): bool
{
return $this === $enum;
}

public function isNot(mixed $enum): bool
public function isNot(UnitEnum $enum): bool
{
return ! $this->is($enum);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/Pest/ComparableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
expect(Role::ADMIN->is(Role::ADMIN))->toBeTrue();

expect(Role::ADMIN->is(Role::GUEST))->toBeFalse();
expect(Role::ADMIN->is('admin'))->toBeFalse();
});

it('the isNot method checks for inequality', function () {
Expand All @@ -16,7 +15,6 @@
expect(Role::ADMIN->isNot(Role::GUEST))->toBeTrue();

expect(Role::ADMIN->isNot(Role::ADMIN))->toBeFalse();
expect(Role::ADMIN->isNot('admin'))->toBeTrue();
});

it('the in method checks for presence in an array', function () {
Expand Down
Loading