From ac51eab59590c844326cf2057ee90354e5e4e8bc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 2 Jun 2025 17:50:55 +0200 Subject: [PATCH 1/3] Bump Symfony 8 to PHP >= 8.4 --- composer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 61f53e0..630e63e 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=8.2", + "php": ">=8.4", "psr/log": "^1|^2|^3" }, "require-dev": { @@ -24,8 +24,7 @@ "predis/predis": "^1.1|^2.0" }, "conflict": { - "doctrine/dbal": "<3.6", - "symfony/cache": "<6.4" + "doctrine/dbal": "<3.6" }, "autoload": { "psr-4": { "Symfony\\Component\\Lock\\": "" }, From d34eadf177014572c28423b8b265d291b86e7aa1 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Sat, 12 Jul 2025 15:55:19 +0200 Subject: [PATCH 2/3] optimize `in_array` calls --- Store/DoctrineDbalPostgreSqlStore.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Store/DoctrineDbalPostgreSqlStore.php b/Store/DoctrineDbalPostgreSqlStore.php index 3abd554..02cffc9 100644 --- a/Store/DoctrineDbalPostgreSqlStore.php +++ b/Store/DoctrineDbalPostgreSqlStore.php @@ -268,7 +268,7 @@ private function filterDsn(#[\SensitiveParameter] string $dsn): string [$scheme, $rest] = explode(':', $dsn, 2); $driver = substr($scheme, 0, strpos($scheme, '+') ?: null); - if (!\in_array($driver, ['pgsql', 'postgres', 'postgresql'])) { + if (!\in_array($driver, ['pgsql', 'postgres', 'postgresql'], true)) { throw new InvalidArgumentException(\sprintf('The adapter "%s" does not support the "%s" driver.', __CLASS__, $driver)); } From eac7c929a97e0a410a51291b406cf83cc0e1ba41 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 17 Jul 2025 19:03:41 +0200 Subject: [PATCH 3/3] Remove legacy code paths that rely on feature checks --- Store/DoctrineDbalStore.php | 25 +++---------------------- Tests/Store/DoctrineDbalStoreTest.php | 19 +------------------ composer.json | 4 ++-- 3 files changed, 6 insertions(+), 42 deletions(-) diff --git a/Store/DoctrineDbalStore.php b/Store/DoctrineDbalStore.php index cf390a0..bd7a903 100644 --- a/Store/DoctrineDbalStore.php +++ b/Store/DoctrineDbalStore.php @@ -14,7 +14,6 @@ use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Connection; use Doctrine\DBAL\DriverManager; -use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception as DBALException; use Doctrine\DBAL\Exception\TableNotFoundException; use Doctrine\DBAL\ParameterType; @@ -219,11 +218,7 @@ public function configureSchema(Schema $schema, \Closure $isSameDatabase): void $table->addColumn($this->tokenCol, 'string', ['length' => 44]); $table->addColumn($this->expirationCol, 'integer', ['unsigned' => true]); - if (class_exists(PrimaryKeyConstraint::class)) { - $table->addPrimaryKeyConstraint(new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted($this->idCol))], true)); - } else { - $table->setPrimaryKey([$this->idCol]); - } + $table->addPrimaryKeyConstraint(new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted($this->idCol))], true)); } /** @@ -243,16 +238,9 @@ private function getCurrentTimestampStatement(): string { $platform = $this->conn->getDatabasePlatform(); - if (interface_exists(Exception::class)) { - // DBAL 4+ - $sqlitePlatformClass = 'Doctrine\DBAL\Platforms\SQLitePlatform'; - } else { - $sqlitePlatformClass = 'Doctrine\DBAL\Platforms\SqlitePlatform'; - } - return match (true) { $platform instanceof \Doctrine\DBAL\Platforms\AbstractMySQLPlatform => 'UNIX_TIMESTAMP()', - $platform instanceof $sqlitePlatformClass => 'strftime(\'%s\',\'now\')', + $platform instanceof \Doctrine\DBAL\Platforms\SQLitePlatform => 'strftime(\'%s\',\'now\')', $platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform => 'CAST(EXTRACT(epoch FROM NOW()) AS INT)', $platform instanceof \Doctrine\DBAL\Platforms\OraclePlatform => '(SYSDATE - TO_DATE(\'19700101\',\'yyyymmdd\'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3))*3600', $platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform => 'DATEDIFF(s, \'1970-01-01\', GETUTCDATE())', @@ -267,16 +255,9 @@ private function platformSupportsTableCreationInTransaction(): bool { $platform = $this->conn->getDatabasePlatform(); - if (interface_exists(Exception::class)) { - // DBAL 4+ - $sqlitePlatformClass = 'Doctrine\DBAL\Platforms\SQLitePlatform'; - } else { - $sqlitePlatformClass = 'Doctrine\DBAL\Platforms\SqlitePlatform'; - } - return match (true) { $platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform, - $platform instanceof $sqlitePlatformClass, + $platform instanceof \Doctrine\DBAL\Platforms\SQLitePlatform, $platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform => true, default => false, }; diff --git a/Tests/Store/DoctrineDbalStoreTest.php b/Tests/Store/DoctrineDbalStoreTest.php index bb4ed1d..37bd0b1 100644 --- a/Tests/Store/DoctrineDbalStoreTest.php +++ b/Tests/Store/DoctrineDbalStoreTest.php @@ -171,25 +171,8 @@ public function testCreatesTableInTransaction(string $platform) public static function providePlatforms(): \Generator { yield [\Doctrine\DBAL\Platforms\PostgreSQLPlatform::class]; - - // DBAL < 4 - if (class_exists(\Doctrine\DBAL\Platforms\PostgreSQL94Platform::class)) { - yield [\Doctrine\DBAL\Platforms\PostgreSQL94Platform::class]; - } - - if (interface_exists(Exception::class)) { - // DBAL 4+ - yield [\Doctrine\DBAL\Platforms\SQLitePlatform::class]; - } else { - yield [\Doctrine\DBAL\Platforms\SqlitePlatform::class]; - } - + yield [\Doctrine\DBAL\Platforms\SQLitePlatform::class]; yield [\Doctrine\DBAL\Platforms\SQLServerPlatform::class]; - - // DBAL < 4 - if (class_exists(\Doctrine\DBAL\Platforms\SQLServer2012Platform::class)) { - yield [\Doctrine\DBAL\Platforms\SQLServer2012Platform::class]; - } } public function testTableCreationInTransactionNotSupported() diff --git a/composer.json b/composer.json index 630e63e..cc8df7d 100644 --- a/composer.json +++ b/composer.json @@ -20,11 +20,11 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/dbal": "^3.6|^4", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0" }, "conflict": { - "doctrine/dbal": "<3.6" + "doctrine/dbal": "<4.3" }, "autoload": { "psr-4": { "Symfony\\Component\\Lock\\": "" }, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy