From 05e38eadbeb3de19e5b26003c2b401e00bb71df4 Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 18 Oct 2026 00:08:23 +0200 Subject: =?UTF-8?q?sortie=20de=20vendor=20du=20d=C3=A9p=C3=B4t,=20oubli=20?= =?UTF-8?q?dans=20config-template.ini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/doctrine/dbal/src/DriverManager.php | 191 ----------------------------- 1 file changed, 191 deletions(-) delete mode 100644 vendor/doctrine/dbal/src/DriverManager.php (limited to 'vendor/doctrine/dbal/src/DriverManager.php') diff --git a/vendor/doctrine/dbal/src/DriverManager.php b/vendor/doctrine/dbal/src/DriverManager.php deleted file mode 100644 index 8b41cbb..0000000 --- a/vendor/doctrine/dbal/src/DriverManager.php +++ /dev/null @@ -1,191 +0,0 @@ -, - * driver?: key-of, - * driverClass?: class-string, - * driverOptions?: array, - * host?: string, - * memory?: bool, - * password?: string, - * path?: string, - * persistent?: bool, - * port?: int, - * serverVersion?: string, - * sessionMode?: int, - * user?: string, - * unix_socket?: string, - * wrapperClass?: class-string, - * } - * @psalm-type Params = array{ - * application_name?: string, - * charset?: string, - * dbname?: string, - * defaultTableOptions?: array, - * driver?: key-of, - * driverClass?: class-string, - * driverOptions?: array, - * host?: string, - * keepReplica?: bool, - * memory?: bool, - * password?: string, - * path?: string, - * persistent?: bool, - * port?: int, - * primary?: OverrideParams, - * replica?: array, - * serverVersion?: string, - * sessionMode?: int, - * user?: string, - * wrapperClass?: class-string, - * unix_socket?: string, - * } - */ -final class DriverManager -{ - /** - * List of supported drivers and their mappings to the driver classes. - * - * To add your own driver use the 'driverClass' parameter to {@see DriverManager::getConnection()}. - */ - private const DRIVER_MAP = [ - 'pdo_mysql' => PDO\MySQL\Driver::class, - 'pdo_sqlite' => PDO\SQLite\Driver::class, - 'pdo_pgsql' => PDO\PgSQL\Driver::class, - 'pdo_oci' => PDO\OCI\Driver::class, - 'oci8' => OCI8\Driver::class, - 'ibm_db2' => IBMDB2\Driver::class, - 'pdo_sqlsrv' => PDO\SQLSrv\Driver::class, - 'mysqli' => Mysqli\Driver::class, - 'pgsql' => PgSQL\Driver::class, - 'sqlsrv' => SQLSrv\Driver::class, - 'sqlite3' => SQLite3\Driver::class, - ]; - - /** - * Private constructor. This class cannot be instantiated. - * - * @codeCoverageIgnore - */ - private function __construct() - { - } - - /** - * Creates a connection object based on the specified parameters. - * This method returns a Doctrine\DBAL\Connection which wraps the underlying - * driver connection. - * - * $params must contain at least one of the following. - * - * Either 'driver' with one of the array keys of {@see DRIVER_MAP}, - * OR 'driverClass' that contains the full class name (with namespace) of the - * driver class to instantiate. - * - * Other (optional) parameters: - * - * user (string): - * The username to use when connecting. - * - * password (string): - * The password to use when connecting. - * - * driverOptions (array): - * Any additional driver-specific options for the driver. These are just passed - * through to the driver. - * - * wrapperClass: - * You may specify a custom wrapper class through the 'wrapperClass' - * parameter but this class MUST inherit from Doctrine\DBAL\Connection. - * - * driverClass: - * The driver class to use. - * - * @param Configuration|null $config The configuration to use. - * @psalm-param Params $params - * - * @psalm-return ($params is array{wrapperClass: class-string} ? T : Connection) - * - * @template T of Connection - */ - public static function getConnection( - #[SensitiveParameter] - array $params, - ?Configuration $config = null, - ): Connection { - $config ??= new Configuration(); - $driver = self::createDriver($params['driver'] ?? null, $params['driverClass'] ?? null); - - foreach ($config->getMiddlewares() as $middleware) { - $driver = $middleware->wrap($driver); - } - - /** @var class-string $wrapperClass */ - $wrapperClass = $params['wrapperClass'] ?? Connection::class; - if (! is_a($wrapperClass, Connection::class, true)) { - throw InvalidWrapperClass::new($wrapperClass); - } - - return new $wrapperClass($params, $driver, $config); - } - - /** - * Returns the list of supported drivers. - * - * @return string[] - * @psalm-return list> - */ - public static function getAvailableDrivers(): array - { - return array_keys(self::DRIVER_MAP); - } - - /** - * @param class-string|null $driverClass - * @param key-of|null $driver - */ - private static function createDriver(?string $driver, ?string $driverClass): Driver - { - if ($driverClass === null) { - if ($driver === null) { - throw DriverRequired::new(); - } - - if (! isset(self::DRIVER_MAP[$driver])) { - throw UnknownDriver::new($driver, array_keys(self::DRIVER_MAP)); - } - - $driverClass = self::DRIVER_MAP[$driver]; - } elseif (! is_a($driverClass, Driver::class, true)) { - throw InvalidDriverClass::new($driverClass); - } - - return new $driverClass(); - } -} -- cgit v1.2.3