-
Notifications
You must be signed in to change notification settings - Fork 0
Improved validation for collection key options #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace ArangoDB\Collection; | ||
|
|
||
| /** | ||
| * Groups the available key generations for new collections | ||
| * | ||
| * @package ArangoDB\Collection | ||
| * @author Lucas S. Vieira | ||
| */ | ||
| class KeyType | ||
| { | ||
| public const string TRADITIONAL = 'traditional'; | ||
Check warningCode scanning / Phpcs (reported by Codacy) Class constants must be uppercase; expected STRING but found string Warning
Class constants must be uppercase; expected STRING but found string
|
||
| public const string AUTOINCREMENT = 'autoincrement'; | ||
Check warningCode scanning / Phpcs (reported by Codacy) Class constants must be uppercase; expected STRING but found string Warning
Class constants must be uppercase; expected STRING but found string
|
||
| public const string PADDED = 'padded'; | ||
Check warningCode scanning / Phpcs (reported by Codacy) Class constants must be uppercase; expected STRING but found string Warning
Class constants must be uppercase; expected STRING but found string
|
||
| public const string UUID = 'uuid'; | ||
Check warningCode scanning / Phpcs (reported by Codacy) Class constants must be uppercase; expected STRING but found string Warning
Class constants must be uppercase; expected STRING but found string
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace ArangoDB\Validation\Exceptions; | ||
|
|
||
| use Throwable; | ||
| use ArangoDB\Exceptions\BaseException; | ||
|
|
||
| /** | ||
| * Invalid collection key option exception. | ||
| * | ||
| * @package ArangoDB\Validation\Exceptions | ||
| * @author Lucas S. Vieira | ||
| */ | ||
| class InvalidKeyOptionException extends BaseException | ||
| { | ||
| /** | ||
| * Parameter name. | ||
| * | ||
| * @var string | ||
| */ | ||
| protected string $parameter; | ||
|
|
||
| /** | ||
| * Parameter value. | ||
| * | ||
| * @var string | ||
| */ | ||
| protected string $type; | ||
|
|
||
| /** | ||
| * InvalidKeyOptionException constructor. | ||
| * | ||
| * @param string $parameter Parameter name. | ||
| * @param string $value Parameter value. | ||
| * @param Throwable|null $previous Previous exception or error. | ||
| */ | ||
| public function __construct(string $parameter, $value, Throwable $previous = null) | ||
| { | ||
| $message = "Parameter '$parameter' can not be used for collection with key type of '$value'."; | ||
| parent::__construct($message, $previous); | ||
| } | ||
| } |
Check warning
Code scanning / Phpcs (reported by Codacy)
Expected at least 1 space before "|"; 0 found Warning