-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise exception when doing first/last operations on an empty Version …
…collection
- Loading branch information
1 parent
fcfaba8
commit 3dad7e5
Showing
3 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Version\Exception; | ||
|
||
use OutOfBoundsException; | ||
|
||
final class CollectionIsEmpty extends OutOfBoundsException implements VersionException | ||
{ | ||
public static function cannotGetFirst(): self | ||
{ | ||
return new self('Cannot get the first Version from an empty collection'); | ||
} | ||
|
||
public static function cannotGetLast(): self | ||
{ | ||
return new self('Cannot get the last Version from an empty collection'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters