-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4429 from morozov/issues/4428
Throw exception on invalid LockMode
- Loading branch information
Showing
5 changed files
with
57 additions
and
18 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,24 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Exception; | ||
|
||
use Doctrine\DBAL\Exception; | ||
|
||
use function sprintf; | ||
|
||
/** | ||
* @psalm-immutable | ||
*/ | ||
class InvalidLockMode extends Exception | ||
{ | ||
public static function fromLockMode(int $lockMode): self | ||
{ | ||
return new self( | ||
sprintf( | ||
'Lock mode %d is invalid. The valid values are LockMode::NONE, LockMode::OPTIMISTIC' | ||
. ', LockMode::PESSIMISTIC_READ and LockMode::PESSIMISTIC_WRITE', | ||
$lockMode | ||
) | ||
); | ||
} | ||
} |
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
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