phpmyadmin/libraries/classes/Dbal/InvalidTableName.php
Maurício Meneghini Fauth 0d4d2a4935
Add exceptions for invalid identifier names
- Adds the PhpMyAdmin\Dbal\InvalidIdentifierName exception
- Adds the PhpMyAdmin\Dbal\InvalidDatabaseName exception
- Adds the PhpMyAdmin\Dbal\InvalidTableName exception

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-19 17:35:35 -03:00

30 lines
681 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Dbal;
use function __;
use function sprintf;
class InvalidTableName extends InvalidIdentifierName
{
public static function fromEmptyName(): self
{
return new self(__('The table name must be a non-empty string.'));
}
/**
* @psalm-param positive-int $length
*/
public static function fromLongName(int $length): self
{
return new self(sprintf(__('The table name cannot be longer than %d characters.'), $length));
}
public static function fromNameWithTrailingSpace(): self
{
return new self(__('The table name cannot end with a space character.'));
}
}