Skip to content
Merged
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: 5 additions & 0 deletions src/EnumHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public function isNot(self $input): bool
return ! $this->is($input);
}

public function isNotAny(iterable $input): bool
{
return ! $this->isAny($input);
}

public static function fromValue(int|string|self $value): static
{
if ($value instanceof self) {
Expand Down
5 changes: 5 additions & 0 deletions tests/LaravelEnumsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
$this->assertFalse(IntEnum::ONE->isAny([IntEnum::TWO, IntEnum::THREE]));
});

test('an enum can check if it is not any of a list of enums', function () {
$this->assertFalse(IntEnum::ONE->isNotAny([IntEnum::ONE, IntEnum::TWO]));
$this->assertTrue(IntEnum::ONE->isNotAny([IntEnum::TWO, IntEnum::THREE]));
});

test('an enum can be created from a value', function () {
$this->assertEquals(IntEnum::ONE, IntEnum::fromValue(1));
});
Expand Down
4 changes: 1 addition & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ protected function getPackageProviders($app): array
];
}

public function getEnvironmentSetUp($app)
{
}
public function getEnvironmentSetUp($app) {}
}