Last active
July 11, 2025 16:40
-
-
Save alisalehi1380/643dcae280bf643e04e23e2b64ef4bd1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace App\Enums; | |
enum IntegerColumnType: string | |
{ | |
case TINYINT = 'tinyInteger'; | |
case UNSIGNED_TINYINT = 'tinyIntegerUnsigned'; | |
case SMALLINT = 'smallInteger'; | |
case UNSIGNED_SMALLINT = 'smallIntegerUnsigned'; | |
case MEDIUMINT = 'mediumInteger'; | |
case UNSIGNED_MEDIUMINT = 'mediumIntegerUnsigned'; | |
case INT = 'integer'; | |
case UNSIGNED_INT = 'integerUnsigned'; | |
case BIGINT = 'bigInteger'; | |
case UNSIGNED_BIGINT = 'unsignedBigInteger'; | |
public function getLimits(): array | |
{ | |
return match ($this) { | |
self::TINYINT => [ | |
'min' => -128, | |
'max' => 127 | |
], | |
self::UNSIGNED_TINYINT => [ | |
'min' => 0, | |
'max' => 255 | |
], | |
self::SMALLINT => [ | |
'min' => -32768, | |
'max' => 32767 | |
], | |
self::UNSIGNED_SMALLINT => [ | |
'min' => 0, | |
'max' => 65535 | |
], | |
self::MEDIUMINT => [ | |
'min' => -8388608, | |
'max' => 8388607 | |
], | |
self::UNSIGNED_MEDIUMINT => [ | |
'min' => 0, | |
'max' => 16777215 | |
], | |
self::INT => [ | |
'min' => -2147483648, | |
'max' => 2147483647 | |
], | |
self::UNSIGNED_INT => [ | |
'min' => 0, | |
'max' => 4294967295 | |
], | |
self::BIGINT => [ | |
'min' => -9223372036854775808, | |
'max' => 9223372036854775807 | |
], | |
self::UNSIGNED_BIGINT => [ | |
'min' => 0, | |
'max' => 18446744073709551615 | |
], | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment