Merge pull request #18477 from MauricioFauth/identifier-name
Create the `Identifiers\Identifier` interface
This commit is contained in:
commit
090da99bdf
@ -10,7 +10,7 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\ConfigStorage\Features\BookmarkFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
|
||||
use function count;
|
||||
use function preg_match_all;
|
||||
|
||||
@ -8,14 +8,14 @@ use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Exceptions\AuthenticationPluginException;
|
||||
use PhpMyAdmin\Exceptions\ConfigException;
|
||||
use PhpMyAdmin\Exceptions\MissingExtensionException;
|
||||
use PhpMyAdmin\Exceptions\SessionHandlerException;
|
||||
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Plugins\AuthenticationPlugin;
|
||||
use PhpMyAdmin\Plugins\AuthenticationPluginFactory;
|
||||
use PhpMyAdmin\SqlParser\Lexer;
|
||||
@ -482,8 +482,8 @@ final class Common
|
||||
{
|
||||
$GLOBALS['urlParams'] ??= null;
|
||||
|
||||
$db = DatabaseName::tryFromValue($request->getParam('db'));
|
||||
$table = TableName::tryFromValue($request->getParam('table'));
|
||||
$db = DatabaseName::tryFrom($request->getParam('db'));
|
||||
$table = TableName::tryFrom($request->getParam('table'));
|
||||
|
||||
$GLOBALS['db'] = $db?->getName() ?? '';
|
||||
$GLOBALS['table'] = $table?->getName() ?? '';
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class BookmarkFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class BrowserTransformationFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class CentralColumnsFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class ColumnCommentsFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class ConfigurableMenusFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class DatabaseDesignerSettingsFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class DisplayFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class ExportTemplatesFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class FavoriteTablesFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class NavigationItemsHidingFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class PdfFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class RecentlyUsedTablesFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class RelationFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class SavedQueryByExampleSearchesFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class SqlHistoryFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class TrackingFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class UiPreferencesFeature
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\ConfigStorage\Features;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class UserPreferencesFeature
|
||||
|
||||
@ -7,8 +7,8 @@ namespace PhpMyAdmin\ConfigStorage;
|
||||
use PhpMyAdmin\ConfigStorage\Features\PdfFeature;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\InternalRelations;
|
||||
use PhpMyAdmin\RecentFavoriteTable;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
|
||||
@ -22,9 +22,9 @@ use PhpMyAdmin\ConfigStorage\Features\SqlHistoryFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Features\TrackingFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Features\UiPreferencesFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Features\UserPreferencesFeature;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Version;
|
||||
|
||||
use function is_string;
|
||||
@ -66,20 +66,20 @@ final class RelationParameters
|
||||
}
|
||||
|
||||
try {
|
||||
$db = DatabaseName::fromValue($params['db'] ?? null);
|
||||
$db = DatabaseName::from($params['db'] ?? null);
|
||||
} catch (InvalidDatabaseName) {
|
||||
return new self($user, null);
|
||||
}
|
||||
|
||||
$bookmarkFeature = null;
|
||||
if (isset($params['bookmarkwork'], $params['bookmark']) && $params['bookmarkwork']) {
|
||||
$bookmark = TableName::tryFromValue($params['bookmark']);
|
||||
$bookmark = TableName::tryFrom($params['bookmark']);
|
||||
if ($bookmark !== null) {
|
||||
$bookmarkFeature = new BookmarkFeature($db, $bookmark);
|
||||
}
|
||||
}
|
||||
|
||||
$columnInfo = TableName::tryFromValue($params['column_info'] ?? null);
|
||||
$columnInfo = TableName::tryFrom($params['column_info'] ?? null);
|
||||
$browserTransformationFeature = null;
|
||||
if (isset($params['mimework']) && $params['mimework'] && $columnInfo !== null) {
|
||||
$browserTransformationFeature = new BrowserTransformationFeature($db, $columnInfo);
|
||||
@ -92,7 +92,7 @@ final class RelationParameters
|
||||
|
||||
$centralColumnsFeature = null;
|
||||
if (isset($params['centralcolumnswork'], $params['central_columns']) && $params['centralcolumnswork']) {
|
||||
$centralColumns = TableName::tryFromValue($params['central_columns']);
|
||||
$centralColumns = TableName::tryFrom($params['central_columns']);
|
||||
if ($centralColumns !== null) {
|
||||
$centralColumnsFeature = new CentralColumnsFeature($db, $centralColumns);
|
||||
}
|
||||
@ -100,8 +100,8 @@ final class RelationParameters
|
||||
|
||||
$configurableMenusFeature = null;
|
||||
if (isset($params['menuswork'], $params['usergroups'], $params['users']) && $params['menuswork']) {
|
||||
$userGroups = TableName::tryFromValue($params['usergroups']);
|
||||
$users = TableName::tryFromValue($params['users']);
|
||||
$userGroups = TableName::tryFrom($params['usergroups']);
|
||||
$users = TableName::tryFrom($params['users']);
|
||||
if ($userGroups !== null && $users !== null) {
|
||||
$configurableMenusFeature = new ConfigurableMenusFeature($db, $userGroups, $users);
|
||||
}
|
||||
@ -109,16 +109,16 @@ final class RelationParameters
|
||||
|
||||
$databaseDesignerSettingsFeature = null;
|
||||
if (isset($params['designersettingswork'], $params['designer_settings']) && $params['designersettingswork']) {
|
||||
$designerSettings = TableName::tryFromValue($params['designer_settings']);
|
||||
$designerSettings = TableName::tryFrom($params['designer_settings']);
|
||||
if ($designerSettings !== null) {
|
||||
$databaseDesignerSettingsFeature = new DatabaseDesignerSettingsFeature($db, $designerSettings);
|
||||
}
|
||||
}
|
||||
|
||||
$relation = TableName::tryFromValue($params['relation'] ?? null);
|
||||
$relation = TableName::tryFrom($params['relation'] ?? null);
|
||||
$displayFeature = null;
|
||||
if (isset($params['displaywork'], $params['table_info']) && $params['displaywork'] && $relation !== null) {
|
||||
$tableInfo = TableName::tryFromValue($params['table_info']);
|
||||
$tableInfo = TableName::tryFrom($params['table_info']);
|
||||
if ($tableInfo !== null) {
|
||||
$displayFeature = new DisplayFeature($db, $relation, $tableInfo);
|
||||
}
|
||||
@ -126,7 +126,7 @@ final class RelationParameters
|
||||
|
||||
$exportTemplatesFeature = null;
|
||||
if (isset($params['exporttemplateswork'], $params['export_templates']) && $params['exporttemplateswork']) {
|
||||
$exportTemplates = TableName::tryFromValue($params['export_templates']);
|
||||
$exportTemplates = TableName::tryFrom($params['export_templates']);
|
||||
if ($exportTemplates !== null) {
|
||||
$exportTemplatesFeature = new ExportTemplatesFeature($db, $exportTemplates);
|
||||
}
|
||||
@ -134,7 +134,7 @@ final class RelationParameters
|
||||
|
||||
$favoriteTablesFeature = null;
|
||||
if (isset($params['favoritework'], $params['favorite']) && $params['favoritework']) {
|
||||
$favorite = TableName::tryFromValue($params['favorite']);
|
||||
$favorite = TableName::tryFrom($params['favorite']);
|
||||
if ($favorite !== null) {
|
||||
$favoriteTablesFeature = new FavoriteTablesFeature($db, $favorite);
|
||||
}
|
||||
@ -142,7 +142,7 @@ final class RelationParameters
|
||||
|
||||
$navigationItemsHidingFeature = null;
|
||||
if (isset($params['navwork'], $params['navigationhiding']) && $params['navwork']) {
|
||||
$navigationHiding = TableName::tryFromValue($params['navigationhiding']);
|
||||
$navigationHiding = TableName::tryFrom($params['navigationhiding']);
|
||||
if ($navigationHiding !== null) {
|
||||
$navigationItemsHidingFeature = new NavigationItemsHidingFeature($db, $navigationHiding);
|
||||
}
|
||||
@ -150,8 +150,8 @@ final class RelationParameters
|
||||
|
||||
$pdfFeature = null;
|
||||
if (isset($params['pdfwork'], $params['pdf_pages'], $params['table_coords']) && $params['pdfwork']) {
|
||||
$pdfPages = TableName::tryFromValue($params['pdf_pages']);
|
||||
$tableCoords = TableName::tryFromValue($params['table_coords']);
|
||||
$pdfPages = TableName::tryFrom($params['pdf_pages']);
|
||||
$tableCoords = TableName::tryFrom($params['table_coords']);
|
||||
if ($pdfPages !== null && $tableCoords !== null) {
|
||||
$pdfFeature = new PdfFeature($db, $pdfPages, $tableCoords);
|
||||
}
|
||||
@ -159,7 +159,7 @@ final class RelationParameters
|
||||
|
||||
$recentlyUsedTablesFeature = null;
|
||||
if (isset($params['recentwork'], $params['recent']) && $params['recentwork']) {
|
||||
$recent = TableName::tryFromValue($params['recent']);
|
||||
$recent = TableName::tryFrom($params['recent']);
|
||||
if ($recent !== null) {
|
||||
$recentlyUsedTablesFeature = new RecentlyUsedTablesFeature($db, $recent);
|
||||
}
|
||||
@ -172,7 +172,7 @@ final class RelationParameters
|
||||
|
||||
$savedQueryByExampleSearchesFeature = null;
|
||||
if (isset($params['savedsearcheswork'], $params['savedsearches']) && $params['savedsearcheswork']) {
|
||||
$savedSearches = TableName::tryFromValue($params['savedsearches']);
|
||||
$savedSearches = TableName::tryFrom($params['savedsearches']);
|
||||
if ($savedSearches !== null) {
|
||||
$savedQueryByExampleSearchesFeature = new SavedQueryByExampleSearchesFeature($db, $savedSearches);
|
||||
}
|
||||
@ -180,7 +180,7 @@ final class RelationParameters
|
||||
|
||||
$sqlHistoryFeature = null;
|
||||
if (isset($params['historywork'], $params['history']) && $params['historywork']) {
|
||||
$history = TableName::tryFromValue($params['history']);
|
||||
$history = TableName::tryFrom($params['history']);
|
||||
if ($history !== null) {
|
||||
$sqlHistoryFeature = new SqlHistoryFeature($db, $history);
|
||||
}
|
||||
@ -188,7 +188,7 @@ final class RelationParameters
|
||||
|
||||
$trackingFeature = null;
|
||||
if (isset($params['trackingwork'], $params['tracking']) && $params['trackingwork']) {
|
||||
$tracking = TableName::tryFromValue($params['tracking']);
|
||||
$tracking = TableName::tryFrom($params['tracking']);
|
||||
if ($tracking !== null) {
|
||||
$trackingFeature = new TrackingFeature($db, $tracking);
|
||||
}
|
||||
@ -196,7 +196,7 @@ final class RelationParameters
|
||||
|
||||
$uiPreferencesFeature = null;
|
||||
if (isset($params['uiprefswork'], $params['table_uiprefs']) && $params['uiprefswork']) {
|
||||
$tableUiPrefs = TableName::tryFromValue($params['table_uiprefs']);
|
||||
$tableUiPrefs = TableName::tryFrom($params['table_uiprefs']);
|
||||
if ($tableUiPrefs !== null) {
|
||||
$uiPreferencesFeature = new UiPreferencesFeature($db, $tableUiPrefs);
|
||||
}
|
||||
@ -204,7 +204,7 @@ final class RelationParameters
|
||||
|
||||
$userPreferencesFeature = null;
|
||||
if (isset($params['userconfigwork'], $params['userconfig']) && $params['userconfigwork']) {
|
||||
$userConfig = TableName::tryFromValue($params['userconfig']);
|
||||
$userConfig = TableName::tryFrom($params['userconfig']);
|
||||
if ($userConfig !== null) {
|
||||
$userPreferencesFeature = new UserPreferencesFeature($db, $userConfig);
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -45,7 +45,7 @@ abstract class AbstractController
|
||||
}
|
||||
|
||||
$GLOBALS['is_db'] = false;
|
||||
$db = DatabaseName::tryFromValue($GLOBALS['db']);
|
||||
$db = DatabaseName::tryFrom($GLOBALS['db']);
|
||||
|
||||
if ($db !== null) {
|
||||
$GLOBALS['is_db'] = $GLOBALS['dbi']->selectDb($db->getName());
|
||||
|
||||
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Template;
|
||||
|
||||
@ -26,7 +26,7 @@ class CheckRelationsController extends AbstractController
|
||||
{
|
||||
$cfgStorageDbName = $this->relation->getConfigurationStorageDbName();
|
||||
|
||||
$db = DatabaseName::tryFromValue($GLOBALS['db']);
|
||||
$db = DatabaseName::tryFrom($GLOBALS['db']);
|
||||
|
||||
// If request for creating the pmadb
|
||||
if ($request->hasBodyParam('create_pmadb') && $this->relation->createPmaDatabase($cfgStorageDbName)) {
|
||||
|
||||
@ -10,10 +10,10 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationCleanup;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -66,9 +66,9 @@ class OperationsController extends AbstractController
|
||||
$move = $request->hasBodyParam('db_rename');
|
||||
|
||||
try {
|
||||
$newDatabaseName = DatabaseName::fromValue($request->getParsedBodyParam('newname'));
|
||||
$newDatabaseName = DatabaseName::from($request->getParsedBodyParam('newname'));
|
||||
if ($this->dbi->getLowerCaseNames() === 1) {
|
||||
$newDatabaseName = DatabaseName::fromValue(mb_strtolower($newDatabaseName->getName()));
|
||||
$newDatabaseName = DatabaseName::from(mb_strtolower($newDatabaseName->getName()));
|
||||
}
|
||||
} catch (InvalidDatabaseName $exception) {
|
||||
$newDatabaseName = null;
|
||||
|
||||
@ -10,9 +10,9 @@ namespace PhpMyAdmin\Controllers\Database;
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Privileges;
|
||||
@ -39,9 +39,9 @@ class PrivilegesController extends AbstractController
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
try {
|
||||
$db = DatabaseName::fromValue($request->getParam('db'));
|
||||
$db = DatabaseName::from($request->getParam('db'));
|
||||
if ($this->dbi->getLowerCaseNames() === 1) {
|
||||
$db = DatabaseName::fromValue(mb_strtolower($db->getName()));
|
||||
$db = DatabaseName::from(mb_strtolower($db->getName()));
|
||||
}
|
||||
} catch (InvalidDatabaseName $exception) {
|
||||
$this->response->addHTML(Message::error($exception->getMessage())->getDisplay());
|
||||
|
||||
@ -7,11 +7,11 @@ namespace PhpMyAdmin\Controllers\Export;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Controllers\Database\ExportController as DatabaseExportController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Exceptions\ExportException;
|
||||
use PhpMyAdmin\Export;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
@ -383,10 +383,10 @@ final class ExportController extends AbstractController
|
||||
}
|
||||
|
||||
if ($lockTables) {
|
||||
$this->export->lockTables(DatabaseName::fromValue($GLOBALS['db']), $GLOBALS['tables'], 'READ');
|
||||
$this->export->lockTables(DatabaseName::from($GLOBALS['db']), $GLOBALS['tables'], 'READ');
|
||||
try {
|
||||
$this->export->exportDatabase(
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$GLOBALS['tables'],
|
||||
$whatStrucOrData,
|
||||
$tableStructure,
|
||||
@ -406,7 +406,7 @@ final class ExportController extends AbstractController
|
||||
}
|
||||
} else {
|
||||
$this->export->exportDatabase(
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$GLOBALS['tables'],
|
||||
$whatStrucOrData,
|
||||
$tableStructure,
|
||||
@ -439,7 +439,7 @@ final class ExportController extends AbstractController
|
||||
|
||||
if ($lockTables) {
|
||||
try {
|
||||
$this->export->lockTables(DatabaseName::fromValue($GLOBALS['db']), [$GLOBALS['table']], 'READ');
|
||||
$this->export->lockTables(DatabaseName::from($GLOBALS['db']), [$GLOBALS['table']], 'READ');
|
||||
$this->export->exportTable(
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['table'],
|
||||
|
||||
@ -9,11 +9,11 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\File;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Import;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ParseAnalyze;
|
||||
@ -317,7 +317,7 @@ final class ImportController extends AbstractController
|
||||
$bookmark = Bookmark::get(
|
||||
$this->dbi,
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$idBookmark,
|
||||
'id',
|
||||
$request->hasBodyParam('action_bookmark_all'),
|
||||
@ -349,7 +349,7 @@ final class ImportController extends AbstractController
|
||||
$bookmark = Bookmark::get(
|
||||
$this->dbi,
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$idBookmark,
|
||||
);
|
||||
if (! $bookmark instanceof Bookmark) {
|
||||
@ -373,7 +373,7 @@ final class ImportController extends AbstractController
|
||||
$bookmark = Bookmark::get(
|
||||
$this->dbi,
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$idBookmark,
|
||||
);
|
||||
if (! $bookmark instanceof Bookmark) {
|
||||
|
||||
@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Normalization;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Normalization;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -24,8 +24,8 @@ final class AddNewPrimaryController extends AbstractController
|
||||
{
|
||||
$numFields = 1;
|
||||
|
||||
$db = DatabaseName::tryFromValue($GLOBALS['db']);
|
||||
$table = TableName::tryFromValue($GLOBALS['table']);
|
||||
$db = DatabaseName::tryFrom($GLOBALS['db']);
|
||||
$table = TableName::tryFrom($GLOBALS['table']);
|
||||
$dbName = isset($db) ? $db->getName() : '';
|
||||
$tableName = isset($table) ? $table->getName() : '';
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Exceptions\ExportException;
|
||||
use PhpMyAdmin\Export;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
|
||||
@ -28,7 +28,7 @@ class SchemaExportController
|
||||
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
$db = DatabaseName::tryFromValue($request->getParsedBodyParam('db'));
|
||||
$db = DatabaseName::tryFrom($request->getParsedBodyParam('db'));
|
||||
/** @var mixed $exportType */
|
||||
$exportType = $request->getParsedBodyParam('export_type');
|
||||
if ($db === null || ! is_string($exportType) || $exportType === '') {
|
||||
|
||||
@ -9,10 +9,10 @@ use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\CreateAddField;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\ColumnsDefinition;
|
||||
@ -105,7 +105,7 @@ class AddFieldController extends AbstractController
|
||||
}
|
||||
|
||||
$GLOBALS['result'] = $createAddField->tryColumnCreationQuery(
|
||||
DatabaseName::fromValue($GLOBALS['db']),
|
||||
DatabaseName::from($GLOBALS['db']),
|
||||
$GLOBALS['sql_query'],
|
||||
$GLOBALS['errorUrl'],
|
||||
);
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
@ -21,10 +21,10 @@ final class DropColumnConfirmationController extends AbstractController
|
||||
{
|
||||
$fields = $request->getParsedBodyParam('selected_fld');
|
||||
try {
|
||||
$db = DatabaseName::fromValue($request->getParsedBodyParam('db'));
|
||||
$table = TableName::fromValue($request->getParsedBodyParam('table'));
|
||||
$db = DatabaseName::from($request->getParsedBodyParam('db'));
|
||||
$table = TableName::from($request->getParsedBodyParam('table'));
|
||||
Assert::allStringNotEmpty($fields);
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$this->sendErrorResponse($exception->getMessage());
|
||||
|
||||
return;
|
||||
|
||||
@ -6,11 +6,11 @@ namespace PhpMyAdmin\Controllers\Table\Maintenance;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\Maintenance;
|
||||
@ -48,12 +48,12 @@ final class AnalyzeController extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$selectedTables = [];
|
||||
foreach ($selectedTablesParam as $table) {
|
||||
$selectedTables[] = TableName::fromValue($table);
|
||||
$selectedTables[] = TableName::from($table);
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->setRequestStatus(false);
|
||||
$this->response->addJSON('message', $message->getDisplay());
|
||||
|
||||
@ -6,11 +6,11 @@ namespace PhpMyAdmin\Controllers\Table\Maintenance;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\Maintenance;
|
||||
@ -48,12 +48,12 @@ final class CheckController extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$selectedTables = [];
|
||||
foreach ($selectedTablesParam as $table) {
|
||||
$selectedTables[] = TableName::fromValue($table);
|
||||
$selectedTables[] = TableName::from($table);
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->setRequestStatus(false);
|
||||
$this->response->addJSON('message', $message->getDisplay());
|
||||
|
||||
@ -6,11 +6,11 @@ namespace PhpMyAdmin\Controllers\Table\Maintenance;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\Maintenance;
|
||||
@ -48,12 +48,12 @@ final class ChecksumController extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$selectedTables = [];
|
||||
foreach ($selectedTablesParam as $table) {
|
||||
$selectedTables[] = TableName::fromValue($table);
|
||||
$selectedTables[] = TableName::from($table);
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->setRequestStatus(false);
|
||||
$this->response->addJSON('message', $message->getDisplay());
|
||||
|
||||
@ -6,11 +6,11 @@ namespace PhpMyAdmin\Controllers\Table\Maintenance;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\Maintenance;
|
||||
@ -48,12 +48,12 @@ final class OptimizeController extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$selectedTables = [];
|
||||
foreach ($selectedTablesParam as $table) {
|
||||
$selectedTables[] = TableName::fromValue($table);
|
||||
$selectedTables[] = TableName::from($table);
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->setRequestStatus(false);
|
||||
$this->response->addJSON('message', $message->getDisplay());
|
||||
|
||||
@ -6,11 +6,11 @@ namespace PhpMyAdmin\Controllers\Table\Maintenance;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Table\Maintenance;
|
||||
@ -48,12 +48,12 @@ final class RepairController extends AbstractController
|
||||
}
|
||||
|
||||
try {
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$selectedTables = [];
|
||||
foreach ($selectedTablesParam as $table) {
|
||||
$selectedTables[] = TableName::fromValue($table);
|
||||
$selectedTables[] = TableName::from($table);
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->setRequestStatus(false);
|
||||
$this->response->addJSON('message', $message->getDisplay());
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class AnalyzeController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class CheckController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class DropController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class OptimizeController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class RebuildController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class RepairController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Controllers\Table\Partition;
|
||||
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partitioning\Maintenance;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -39,9 +39,9 @@ final class TruncateController extends AbstractController
|
||||
|
||||
try {
|
||||
Assert::stringNotEmpty($partitionName, __('The partition name must be a non-empty string.'));
|
||||
$database = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName | InvalidArgumentException $exception) {
|
||||
$database = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier | InvalidArgumentException $exception) {
|
||||
$message = Message::error($exception->getMessage());
|
||||
$this->response->addHTML($message->getDisplay());
|
||||
|
||||
|
||||
@ -10,10 +10,10 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
use PhpMyAdmin\CheckUserPrivileges;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Privileges;
|
||||
@ -40,13 +40,13 @@ class PrivilegesController extends AbstractController
|
||||
public function __invoke(ServerRequest $request): void
|
||||
{
|
||||
try {
|
||||
$db = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
$db = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
if ($this->dbi->getLowerCaseNames() === 1) {
|
||||
$db = DatabaseName::fromValue(mb_strtolower($db->getName()));
|
||||
$table = TableName::fromValue(mb_strtolower($table->getName()));
|
||||
$db = DatabaseName::from(mb_strtolower($db->getName()));
|
||||
$table = TableName::from(mb_strtolower($table->getName()));
|
||||
}
|
||||
} catch (InvalidIdentifierName $exception) {
|
||||
} catch (InvalidIdentifier $exception) {
|
||||
$this->response->addHTML(Message::error($exception->getMessage())->getDisplay());
|
||||
|
||||
return;
|
||||
|
||||
@ -8,11 +8,11 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
@ -52,9 +52,9 @@ class WrapperController extends AbstractController
|
||||
$this->response->getHeader()->setIsTransformationWrapper(true);
|
||||
|
||||
try {
|
||||
$db = DatabaseName::fromValue($request->getParam('db'));
|
||||
$table = TableName::fromValue($request->getParam('table'));
|
||||
} catch (InvalidIdentifierName) {
|
||||
$db = DatabaseName::from($request->getParam('db'));
|
||||
$table = TableName::from($request->getParam('table'));
|
||||
} catch (InvalidIdentifier) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
|
||||
use function count;
|
||||
use function implode;
|
||||
|
||||
@ -7,7 +7,6 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\DbalInterface;
|
||||
use PhpMyAdmin\Dbal\DbiExtension;
|
||||
use PhpMyAdmin\Dbal\DbiMysqli;
|
||||
@ -15,6 +14,7 @@ use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Dbal\Statement;
|
||||
use PhpMyAdmin\Dbal\Warning;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Query\Cache;
|
||||
use PhpMyAdmin\Query\Compatibility;
|
||||
use PhpMyAdmin\Query\Generator as QueryGenerator;
|
||||
|
||||
@ -8,6 +8,7 @@ use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\FieldMetadata;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\SystemDatabase;
|
||||
use PhpMyAdmin\Table;
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
|
||||
/**
|
||||
* Contract for every database extension supported by phpMyAdmin
|
||||
|
||||
@ -11,6 +11,7 @@ use mysqli;
|
||||
use mysqli_sql_exception;
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
|
||||
use function __;
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class InvalidIdentifierName extends InvalidArgumentException
|
||||
{
|
||||
}
|
||||
@ -10,8 +10,8 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\Controllers\Database\ExportController as DatabaseExportController;
|
||||
use PhpMyAdmin\Controllers\Server\ExportController as ServerExportController;
|
||||
use PhpMyAdmin\Controllers\Table\ExportController as TableExportController;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Exceptions\ExportException;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\ExportPlugin;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
|
||||
@ -579,7 +579,7 @@ class Export
|
||||
|
||||
$tables = $this->dbi->getTables($currentDb);
|
||||
$this->exportDatabase(
|
||||
DatabaseName::fromValue($currentDb),
|
||||
DatabaseName::from($currentDb),
|
||||
$tables,
|
||||
$whatStrucOrData,
|
||||
$tables,
|
||||
|
||||
@ -6,8 +6,8 @@ namespace PhpMyAdmin\Export;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
@ -2,14 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use Stringable;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class DatabaseName implements Stringable
|
||||
final class DatabaseName implements Identifier
|
||||
{
|
||||
/**
|
||||
* @see https://dev.mysql.com/doc/refman/en/identifier-length.html
|
||||
@ -44,13 +43,17 @@ final class DatabaseName implements Stringable
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/** @throws InvalidDatabaseName */
|
||||
public static function fromValue(mixed $name): self
|
||||
/**
|
||||
* @throws InvalidDatabaseName
|
||||
*
|
||||
* @psalm-assert non-empty-string $name
|
||||
*/
|
||||
public static function from(mixed $name): static
|
||||
{
|
||||
return new self($name);
|
||||
}
|
||||
|
||||
public static function tryFromValue(mixed $name): self|null
|
||||
public static function tryFrom(mixed $name): static|null
|
||||
{
|
||||
try {
|
||||
return new self($name);
|
||||
31
libraries/classes/Identifiers/Identifier.php
Normal file
31
libraries/classes/Identifiers/Identifier.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use Stringable;
|
||||
|
||||
/**
|
||||
* @see https://dev.mysql.com/doc/refman/en/identifiers.html
|
||||
* @see https://mariadb.com/kb/en/identifier-names/
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
interface Identifier extends Stringable
|
||||
{
|
||||
/**
|
||||
* @throws InvalidIdentifier
|
||||
*
|
||||
* @psalm-assert non-empty-string $name
|
||||
*/
|
||||
public static function from(mixed $name): static;
|
||||
|
||||
public static function tryFrom(mixed $name): static|null;
|
||||
|
||||
/** @psalm-return non-empty-string */
|
||||
public function getName(): string;
|
||||
|
||||
/** @psalm-return non-empty-string */
|
||||
public function __toString(): string;
|
||||
}
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use function __;
|
||||
use function sprintf;
|
||||
|
||||
class InvalidDatabaseName extends InvalidIdentifierName
|
||||
class InvalidDatabaseName extends InvalidIdentifier
|
||||
{
|
||||
public static function fromEmptyName(): self
|
||||
{
|
||||
11
libraries/classes/Identifiers/InvalidIdentifier.php
Normal file
11
libraries/classes/Identifiers/InvalidIdentifier.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class InvalidIdentifier extends InvalidArgumentException
|
||||
{
|
||||
}
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use function __;
|
||||
use function sprintf;
|
||||
|
||||
class InvalidTableName extends InvalidIdentifierName
|
||||
class InvalidTableName extends InvalidIdentifier
|
||||
{
|
||||
public static function fromEmptyName(): self
|
||||
{
|
||||
@ -2,14 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Triggers;
|
||||
|
||||
use PhpMyAdmin\Dbal\InvalidIdentifierName;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use function __;
|
||||
use function sprintf;
|
||||
|
||||
final class InvalidTriggerName extends InvalidIdentifierName
|
||||
final class InvalidTriggerName extends InvalidIdentifier
|
||||
{
|
||||
public static function fromEmptyName(): self
|
||||
{
|
||||
@ -2,14 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Dbal;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use Stringable;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class TableName implements Stringable
|
||||
final class TableName implements Identifier
|
||||
{
|
||||
/**
|
||||
* @see https://dev.mysql.com/doc/refman/en/identifier-length.html
|
||||
@ -44,13 +43,17 @@ final class TableName implements Stringable
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/** @throws InvalidTableName */
|
||||
public static function fromValue(mixed $name): self
|
||||
/**
|
||||
* @throws InvalidTableName
|
||||
*
|
||||
* @psalm-assert non-empty-string $name
|
||||
*/
|
||||
public static function from(mixed $name): static
|
||||
{
|
||||
return new self($name);
|
||||
}
|
||||
|
||||
public static function tryFromValue(mixed $name): self|null
|
||||
public static function tryFrom(mixed $name): static|null
|
||||
{
|
||||
try {
|
||||
return new self($name);
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Triggers;
|
||||
namespace PhpMyAdmin\Identifiers;
|
||||
|
||||
use Stringable;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
final class TriggerName implements Stringable
|
||||
/** @psalm-immutable */
|
||||
final class TriggerName implements Identifier
|
||||
{
|
||||
/**
|
||||
* @see https://dev.mysql.com/doc/refman/en/identifier-length.html
|
||||
@ -43,13 +43,17 @@ final class TriggerName implements Stringable
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/** @throws InvalidTriggerName */
|
||||
public static function fromValue(mixed $name): self
|
||||
/**
|
||||
* @throws InvalidTriggerName
|
||||
*
|
||||
* @psalm-assert non-empty-string $name
|
||||
*/
|
||||
public static function from(mixed $name): static
|
||||
{
|
||||
return new self($name);
|
||||
}
|
||||
|
||||
public static function tryFromValue(mixed $name): self|null
|
||||
public static function tryFrom(mixed $name): static|null
|
||||
{
|
||||
try {
|
||||
return new self($name);
|
||||
@ -7,8 +7,8 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Database\Events;
|
||||
use PhpMyAdmin\Database\Routines;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Engines\Innodb;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Partitioning\Partition;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Triggers\Triggers;
|
||||
|
||||
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Partitioning;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema\Dia;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
|
||||
use function in_array;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema\Eps;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Version;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema\Pdf;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Pdf as PdfLib;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Transformations;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Dia\DiaRelationSchema;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Eps\EpsRelationSchema;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\SvgRelationSchema;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins\Schema\Svg;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Version;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Plugins;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Plugins\PluginPropertyItem;
|
||||
|
||||
@ -13,11 +13,11 @@ use PhpMyAdmin\ConfigStorage\RelationCleanup;
|
||||
use PhpMyAdmin\Database\Routines;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Compatibility;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
|
||||
@ -7,13 +7,13 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\ConfigStorage\Features\BookmarkFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationCleanup;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Display\DeleteLinkEnum;
|
||||
use PhpMyAdmin\Display\DisplayParts;
|
||||
use PhpMyAdmin\Display\Results as DisplayResults;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Html\MySQLDocumentation;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Query\Generator as QueryGenerator;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
@ -431,7 +431,7 @@ class Sql
|
||||
$bookmark = Bookmark::get(
|
||||
$this->dbi,
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
DatabaseName::fromValue($db),
|
||||
DatabaseName::from($db),
|
||||
$table,
|
||||
'label',
|
||||
false,
|
||||
|
||||
@ -8,8 +8,8 @@ use PhpMyAdmin\Common;
|
||||
use PhpMyAdmin\Controllers\Table\StructureController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Compatibility;
|
||||
|
||||
@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Table;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Dbal\Warning;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Table\Maintenance\Message;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tracking;
|
||||
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
|
||||
final class TrackedTable
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@ use PhpMyAdmin\ConfigStorage\Features\TrackingFeature;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
use function array_column;
|
||||
@ -76,7 +76,7 @@ class TrackingChecker
|
||||
|
||||
$trackedTables = [];
|
||||
foreach ($this->dbi->queryAsControlUser($sqlQuery) as $row) {
|
||||
$trackedTable = new TrackedTable(TableName::fromValue($row['table_name']), (bool) $row['tracking_active']);
|
||||
$trackedTable = new TrackedTable(TableName::from($row['table_name']), (bool) $row['tracking_active']);
|
||||
$trackedTables[$trackedTable->name->getName()] = $trackedTable;
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Triggers;
|
||||
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Identifiers\TriggerName;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
@ -31,7 +32,7 @@ final class Trigger
|
||||
$statement = $trigger['Statement'] ?? $trigger['ACTION_STATEMENT'] ?? null;
|
||||
$definer = $trigger['Definer'] ?? $trigger['DEFINER'] ?? null;
|
||||
Assert::string($name);
|
||||
$name = TriggerName::tryFromValue($name);
|
||||
$name = TriggerName::tryFrom($name);
|
||||
Assert::notNull($name);
|
||||
Assert::string($timing);
|
||||
$timing = Timing::tryFrom($timing);
|
||||
@ -40,7 +41,7 @@ final class Trigger
|
||||
$event = Event::tryFrom($event);
|
||||
Assert::notNull($event);
|
||||
Assert::string($table);
|
||||
$table = TableName::tryFromValue($table);
|
||||
$table = TableName::tryFrom($table);
|
||||
Assert::notNull($table);
|
||||
Assert::string($statement);
|
||||
Assert::string($definer);
|
||||
|
||||
@ -8,7 +8,7 @@ use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\Config\Forms\User\UserFormList;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
|
||||
use function __;
|
||||
use function array_flip;
|
||||
|
||||
@ -2731,7 +2731,7 @@ parameters:
|
||||
path: libraries/classes/Database/CentralColumns.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$dbname of method PhpMyAdmin\\\\DatabaseInterface\\:\\:selectDb\\(\\) expects PhpMyAdmin\\\\Dbal\\\\DatabaseName\\|string, mixed given\\.$#"
|
||||
message: "#^Parameter \\#1 \\$dbname of method PhpMyAdmin\\\\DatabaseInterface\\:\\:selectDb\\(\\) expects PhpMyAdmin\\\\Identifiers\\\\DatabaseName\\|string, mixed given\\.$#"
|
||||
count: 8
|
||||
path: libraries/classes/Database/CentralColumns.php
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ namespace PhpMyAdmin\Tests;
|
||||
use PhpMyAdmin\Bookmark;
|
||||
use PhpMyAdmin\ConfigStorage\Features\BookmarkFeature;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
|
||||
/** @covers \PhpMyAdmin\Bookmark */
|
||||
@ -49,7 +49,7 @@ class BookmarkTest extends AbstractTestCase
|
||||
['id', 'dbase', 'user', 'label', 'query'],
|
||||
);
|
||||
$actual = Bookmark::getList(
|
||||
new BookmarkFeature(DatabaseName::fromValue('phpmyadmin'), TableName::fromValue('pma_bookmark')),
|
||||
new BookmarkFeature(DatabaseName::from('phpmyadmin'), TableName::from('pma_bookmark')),
|
||||
$GLOBALS['dbi'],
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
'sakila',
|
||||
@ -68,7 +68,7 @@ class BookmarkTest extends AbstractTestCase
|
||||
Bookmark::get(
|
||||
$GLOBALS['dbi'],
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
DatabaseName::fromValue('phpmyadmin'),
|
||||
DatabaseName::from('phpmyadmin'),
|
||||
'1',
|
||||
),
|
||||
);
|
||||
|
||||
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\ConfigStorage;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Version;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@ use Generator;
|
||||
use PhpMyAdmin\ConfigStorage\Features\ConfigurableMenusFeature;
|
||||
use PhpMyAdmin\ConfigStorage\UserGroups;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
use PhpMyAdmin\Tests\Stubs\DummyResult;
|
||||
@ -33,9 +33,9 @@ class UserGroupsTest extends AbstractTestCase
|
||||
$GLOBALS['table'] = '';
|
||||
|
||||
$this->configurableMenusFeature = new ConfigurableMenusFeature(
|
||||
DatabaseName::fromValue('pmadb'),
|
||||
TableName::fromValue('usergroups'),
|
||||
TableName::fromValue('users'),
|
||||
DatabaseName::from('pmadb'),
|
||||
TableName::from('usergroups'),
|
||||
TableName::from('users'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Export;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Export\ExportPhparray;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Transformations;
|
||||
@ -115,7 +115,7 @@ class ExportTest extends AbstractTestCase
|
||||
$export = new Export($dbi);
|
||||
|
||||
$export->exportDatabase(
|
||||
DatabaseName::fromValue('test_db'),
|
||||
DatabaseName::from('test_db'),
|
||||
['test_table'],
|
||||
'structure_and_data',
|
||||
['test_table'],
|
||||
|
||||
@ -2,24 +2,24 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Dbal;
|
||||
namespace PhpMyAdmin\Tests\Identifiers;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\InvalidDatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidDatabaseName;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function str_repeat;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Dbal\DatabaseName
|
||||
* @covers \PhpMyAdmin\Dbal\InvalidDatabaseName
|
||||
* @covers \PhpMyAdmin\Identifiers\DatabaseName
|
||||
* @covers \PhpMyAdmin\Identifiers\InvalidDatabaseName
|
||||
*/
|
||||
class DatabaseNameTest extends TestCase
|
||||
{
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testValidName(string $validName): void
|
||||
{
|
||||
$name = DatabaseName::fromValue($validName);
|
||||
$name = DatabaseName::from($validName);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
}
|
||||
@ -27,7 +27,7 @@ class DatabaseNameTest extends TestCase
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testTryFromValueWithValidName(string $validName): void
|
||||
{
|
||||
$name = DatabaseName::tryFromValue($validName);
|
||||
$name = DatabaseName::tryFrom($validName);
|
||||
$this->assertNotNull($name);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
@ -44,10 +44,10 @@ class DatabaseNameTest extends TestCase
|
||||
/** @dataProvider providerForTestInvalidNames */
|
||||
public function testInvalidNames(mixed $name, string $exceptionMessage): void
|
||||
{
|
||||
$this->assertNull(DatabaseName::tryFromValue($name));
|
||||
$this->assertNull(DatabaseName::tryFrom($name));
|
||||
$this->expectException(InvalidDatabaseName::class);
|
||||
$this->expectExceptionMessage($exceptionMessage);
|
||||
DatabaseName::fromValue($name);
|
||||
DatabaseName::from($name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2,24 +2,24 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Dbal;
|
||||
namespace PhpMyAdmin\Tests\Identifiers;
|
||||
|
||||
use PhpMyAdmin\Dbal\InvalidTableName;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\InvalidTableName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function str_repeat;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Dbal\TableName
|
||||
* @covers \PhpMyAdmin\Dbal\InvalidTableName
|
||||
* @covers \PhpMyAdmin\Identifiers\TableName
|
||||
* @covers \PhpMyAdmin\Identifiers\InvalidTableName
|
||||
*/
|
||||
class TableNameTest extends TestCase
|
||||
{
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testValidName(string $validName): void
|
||||
{
|
||||
$name = TableName::fromValue($validName);
|
||||
$name = TableName::from($validName);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
}
|
||||
@ -27,7 +27,7 @@ class TableNameTest extends TestCase
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testTryFromValueValidName(string $validName): void
|
||||
{
|
||||
$name = TableName::tryFromValue($validName);
|
||||
$name = TableName::tryFrom($validName);
|
||||
$this->assertNotNull($name);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
@ -44,10 +44,10 @@ class TableNameTest extends TestCase
|
||||
/** @dataProvider providerForTestInvalidNames */
|
||||
public function testInvalidNames(mixed $name, string $exceptionMessage): void
|
||||
{
|
||||
$this->assertNull(TableName::tryFromValue($name));
|
||||
$this->assertNull(TableName::tryFrom($name));
|
||||
$this->expectException(InvalidTableName::class);
|
||||
$this->expectExceptionMessage($exceptionMessage);
|
||||
TableName::fromValue($name);
|
||||
TableName::from($name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2,24 +2,24 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Triggers;
|
||||
namespace PhpMyAdmin\Tests\Identifiers;
|
||||
|
||||
use PhpMyAdmin\Triggers\InvalidTriggerName;
|
||||
use PhpMyAdmin\Triggers\TriggerName;
|
||||
use PhpMyAdmin\Identifiers\InvalidTriggerName;
|
||||
use PhpMyAdmin\Identifiers\TriggerName;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function str_repeat;
|
||||
|
||||
/**
|
||||
* @covers \PhpMyAdmin\Triggers\InvalidTriggerName
|
||||
* @covers \PhpMyAdmin\Triggers\TriggerName
|
||||
* @covers \PhpMyAdmin\Identifiers\InvalidTriggerName
|
||||
* @covers \PhpMyAdmin\Identifiers\TriggerName
|
||||
*/
|
||||
final class TriggerNameTest extends TestCase
|
||||
{
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testValidName(string $validName): void
|
||||
{
|
||||
$name = TriggerName::fromValue($validName);
|
||||
$name = TriggerName::from($validName);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
}
|
||||
@ -27,7 +27,7 @@ final class TriggerNameTest extends TestCase
|
||||
/** @dataProvider providerForTestValidNames */
|
||||
public function testTryFromValueValidName(string $validName): void
|
||||
{
|
||||
$name = TriggerName::tryFromValue($validName);
|
||||
$name = TriggerName::tryFrom($validName);
|
||||
$this->assertNotNull($name);
|
||||
$this->assertEquals($validName, $name->getName());
|
||||
$this->assertEquals($validName, (string) $name);
|
||||
@ -44,10 +44,10 @@ final class TriggerNameTest extends TestCase
|
||||
/** @dataProvider providerForTestInvalidNames */
|
||||
public function testInvalidNames(mixed $name, string $exceptionMessage): void
|
||||
{
|
||||
$this->assertNull(TriggerName::tryFromValue($name));
|
||||
$this->assertNull(TriggerName::tryFrom($name));
|
||||
$this->expectException(InvalidTriggerName::class);
|
||||
$this->expectExceptionMessage($exceptionMessage);
|
||||
TriggerName::fromValue($name);
|
||||
TriggerName::from($name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Dia\DiaRelationSchema;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
|
||||
@ -41,7 +41,7 @@ class DiaRelationSchemaTest extends AbstractTestCase
|
||||
$GLOBALS['db'] = 'test_db';
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = true;
|
||||
|
||||
$this->object = new DiaRelationSchema(DatabaseName::fromValue('test_db'));
|
||||
$this->object = new DiaRelationSchema(DatabaseName::from('test_db'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Eps\EpsRelationSchema;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
|
||||
@ -39,7 +39,7 @@ class EpsRelationSchemaTest extends AbstractTestCase
|
||||
$GLOBALS['db'] = 'test_db';
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = true;
|
||||
|
||||
$this->object = new EpsRelationSchema(DatabaseName::fromValue('test_db'));
|
||||
$this->object = new EpsRelationSchema(DatabaseName::from('test_db'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
|
||||
@ -24,7 +24,7 @@ class ExportRelationSchemaTest extends AbstractTestCase
|
||||
|
||||
$GLOBALS['dbi'] = $this->createDatabaseInterface();
|
||||
$_REQUEST['page_number'] = 33;
|
||||
$this->object = new ExportRelationSchema(DatabaseName::fromValue('test_db'), null);
|
||||
$this->object = new ExportRelationSchema(DatabaseName::from('test_db'), null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Pdf\PdfRelationSchema;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
|
||||
@ -42,7 +42,7 @@ class PdfRelationSchemaTest extends AbstractTestCase
|
||||
$GLOBALS['db'] = 'test_db';
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = true;
|
||||
|
||||
$this->object = new PdfRelationSchema(DatabaseName::fromValue('test_db'));
|
||||
$this->object = new PdfRelationSchema(DatabaseName::from('test_db'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\SvgRelationSchema;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
|
||||
@ -44,7 +44,7 @@ class SvgRelationSchemaTest extends AbstractTestCase
|
||||
$GLOBALS['text_dir'] = 'en';
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = true;
|
||||
|
||||
$this->object = new SvgRelationSchema(DatabaseName::fromValue('test_db'));
|
||||
$this->object = new SvgRelationSchema(DatabaseName::from('test_db'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -13,11 +13,11 @@ namespace PhpMyAdmin\Tests\Stubs;
|
||||
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DatabaseName;
|
||||
use PhpMyAdmin\Dbal\DbiExtension;
|
||||
use PhpMyAdmin\Dbal\ResultInterface;
|
||||
use PhpMyAdmin\Dbal\Statement;
|
||||
use PhpMyAdmin\FieldMetadata;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Tests\FieldHelper;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use stdClass;
|
||||
|
||||
@ -7,7 +7,7 @@ namespace PhpMyAdmin\Tests\Tracking;
|
||||
use PhpMyAdmin\Cache;
|
||||
use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\ConfigStorage\RelationParameters;
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use PhpMyAdmin\Identifiers\TableName;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PhpMyAdmin\Tracking\TrackedTable;
|
||||
use PhpMyAdmin\Tracking\Tracker;
|
||||
@ -55,8 +55,8 @@ class TrackingCheckerTest extends AbstractTestCase
|
||||
Tracker::enable();
|
||||
|
||||
$expectation = [
|
||||
0 => new TrackedTable(TableName::fromValue('0'), true),
|
||||
'actor' => new TrackedTable(TableName::fromValue('actor'), false),
|
||||
0 => new TrackedTable(TableName::from('0'), true),
|
||||
'actor' => new TrackedTable(TableName::from('actor'), false),
|
||||
];
|
||||
|
||||
$actual = $this->trackingChecker->getTrackedTables('dummyDb');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user