Skip to content

Commit 413d5e2

Browse files
committed
Merge branch '4.3.x' into 5.0.x
* 4.3.x: phpunit/phpunit (11.5.15 => 11.5.23) (#7006) Deprecate support for MariaDB 10.5 (#7000) Fix new and previously ignored PHPStan errors Ignore new PHPStan errors Bump dev tools (#7002) fix(PgSQL): Allow to pass IPv6 address in URI notation for postgres (#6344) Run tests on MySQL 9.3 instead of 9.1 (#7001) CI MariaDB: add 11.8 (#6991)
2 parents 208ddde + 5fe0953 commit 413d5e2

File tree

10 files changed

+91
-12
lines changed

10 files changed

+91
-12
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
- "10.6" # LTS (Jul 2026) We have code specific to 10.6.0-10.10.0
143143
- "10.11" # LTS (Feb 2028) We have code specific to ^10.10
144144
- "11.4" # LTS (May 2029)
145+
- "11.8" # LTS (Jun 2028)
145146
extension:
146147
- "mysqli"
147148
- "pdo_mysql"
@@ -170,7 +171,7 @@ jobs:
170171
- "8.4"
171172
mysql-version:
172173
- "8.0"
173-
- "9.1"
174+
- "9.3"
174175
extension:
175176
- "mysqli"
176177
- "pdo_mysql"

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ all drivers and middleware.
348348

349349
# Upgrade to 4.3
350350

351+
## Deprecated support for MariaDB 10.5
352+
353+
* Upgrade to MariaDB 10.6 or later.
354+
351355
## Deprecated `Column` methods
352356

353357
The following `Column` methods have been deprecated:

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
"doctrine/coding-standard": "13.0.0",
4141
"fig/log-test": "^1",
4242
"jetbrains/phpstorm-stubs": "2023.2",
43-
"phpstan/phpstan": "2.1.1",
43+
"phpstan/phpstan": "2.1.17",
4444
"phpstan/phpstan-phpunit": "2.0.6",
4545
"phpstan/phpstan-strict-rules": "^2",
46-
"phpunit/phpunit": "11.5.15",
46+
"phpunit/phpunit": "11.5.23",
4747
"slevomat/coding-standard": "8.16.2",
48-
"squizlabs/php_codesniffer": "3.12.0",
48+
"squizlabs/php_codesniffer": "3.13.1",
4949
"symfony/cache": "^6.3.8|^7.0",
5050
"symfony/console": "^5.4|^6.3|^7.0"
5151
},

src/Driver/AbstractMySQLDriver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1515
use Doctrine\DBAL\Platforms\MySQLPlatform;
1616
use Doctrine\DBAL\ServerVersionProvider;
17+
use Doctrine\Deprecations\Deprecation;
1718

1819
use function preg_match;
1920
use function stripos;
@@ -42,6 +43,12 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
4243
return new MariaDB1060Platform();
4344
}
4445

46+
Deprecation::trigger(
47+
'doctrine/dbal',
48+
'https://github.com/doctrine/dbal/pull/6343',
49+
'Support for MariaDB < 10.6.0 is deprecated and will be removed in DBAL 5',
50+
);
51+
4552
return new MariaDBPlatform();
4653
}
4754

src/Driver/PgSQL/Connection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function __construct(private PgSqlConnection $connection)
3131

3232
public function __destruct()
3333
{
34+
// @phpstan-ignore isset.initializedProperty
3435
if (! isset($this->connection)) {
3536
return;
3637
}

src/Driver/PgSQL/Driver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use function func_get_args;
1818
use function implode;
1919
use function pg_connect;
20+
use function preg_match;
2021
use function restore_error_handler;
2122
use function set_error_handler;
2223
use function sprintf;
@@ -66,9 +67,18 @@ private function constructConnectionString(
6667
#[SensitiveParameter]
6768
array $params,
6869
): string {
70+
// pg_connect used by Doctrine DBAL does not support [...] notation,
71+
// but requires the host address in plain form like `aa:bb:99...`
72+
$matches = [];
73+
if (isset($params['host']) && preg_match('/^\[(.+)\]$/', $params['host'], $matches) === 1) {
74+
$params['hostaddr'] = $matches[1];
75+
unset($params['host']);
76+
}
77+
6978
$components = array_filter(
7079
[
7180
'host' => $params['host'] ?? null,
81+
'hostaddr' => $params['hostaddr'] ?? null,
7282
'port' => $params['port'] ?? null,
7383
'dbname' => $params['dbname'] ?? 'postgres',
7484
'user' => $params['user'] ?? null,

src/Driver/PgSQL/Statement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function __construct(
3939

4040
public function __destruct()
4141
{
42+
// @phpstan-ignore isset.initializedProperty
4243
if (! isset($this->connection)) {
4344
return;
4445
}

src/Platforms/MariaDB1060Platform.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/**
1010
* Provides the behavior, features and SQL dialect of the MariaDB 10.6 database platform.
11+
*
12+
* @deprecated This class will be removed once support for MariaDB 10.5 is dropped.
1113
*/
1214
class MariaDB1060Platform extends MariaDBPlatform
1315
{

src/Schema/TableEditor.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,21 @@ final class TableEditor
4343
/** @internal Use {@link Table::editor()} or {@link Table::edit()} to create an instance */
4444
public function __construct()
4545
{
46-
// @phpstan-ignore assign.propertyType (PHPStan doesn't infer the element type)
47-
$this->columns = new UnqualifiedNamedObjectSet();
46+
/** @var UnqualifiedNamedObjectSet<Column> $columns */
47+
$columns = new UnqualifiedNamedObjectSet();
48+
$this->columns = $columns;
4849

49-
// @phpstan-ignore assign.propertyType
50-
$this->indexes = new UnqualifiedNamedObjectSet();
50+
/** @var UnqualifiedNamedObjectSet<Index> $indexes */
51+
$indexes = new UnqualifiedNamedObjectSet();
52+
$this->indexes = $indexes;
5153

52-
// @phpstan-ignore assign.propertyType
53-
$this->uniqueConstraints = new OptionallyUnqualifiedNamedObjectSet();
54+
/** @var OptionallyUnqualifiedNamedObjectSet<UniqueConstraint> $uniqueConstraints */
55+
$uniqueConstraints = new OptionallyUnqualifiedNamedObjectSet();
56+
$this->uniqueConstraints = $uniqueConstraints;
5457

55-
// @phpstan-ignore assign.propertyType
56-
$this->foreignKeyConstraints = new OptionallyUnqualifiedNamedObjectSet();
58+
/** @var OptionallyUnqualifiedNamedObjectSet<ForeignKeyConstraint> $foreignKeyConstraints */
59+
$foreignKeyConstraints = new OptionallyUnqualifiedNamedObjectSet();
60+
$this->foreignKeyConstraints = $foreignKeyConstraints;
5761
}
5862

5963
public function setName(OptionallyQualifiedName $name): self

tests/Driver/PgSQL/DriverTest.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\DBAL\Tests\Driver\PgSQL;
6+
7+
use Doctrine\DBAL\Driver as DriverInterface;
8+
use Doctrine\DBAL\Driver\PgSQL\Driver;
9+
use Doctrine\DBAL\Tests\Driver\AbstractPostgreSQLDriverTestCase;
10+
use Doctrine\DBAL\Tests\TestUtil;
11+
12+
use function in_array;
13+
14+
class DriverTest extends AbstractPostgreSQLDriverTestCase
15+
{
16+
protected function setUp(): void
17+
{
18+
parent::setUp();
19+
20+
if (isset($GLOBALS['db_driver']) && $GLOBALS['db_driver'] === 'pgsql') {
21+
return;
22+
}
23+
24+
self::markTestSkipped('Test enabled only when using pgsql specific phpunit.xml');
25+
}
26+
27+
/**
28+
* Ensure we can handle URI notation for IPv6 addresses
29+
*/
30+
public function testConnectionIPv6(): void
31+
{
32+
if (! in_array($GLOBALS['db_host'], ['localhost', '127.0.0.1', '[::1]'], true)) {
33+
// We cannot assume that every contributor runs the same setup as our CI
34+
self::markTestSkipped('This test only works if there is a Postgres server listening on localhost.');
35+
}
36+
37+
self::expectNotToPerformAssertions();
38+
39+
$params = TestUtil::getConnectionParams();
40+
$params['host'] = '[::1]';
41+
42+
$this->driver->connect($params);
43+
}
44+
45+
protected function createDriver(): DriverInterface
46+
{
47+
return new Driver();
48+
}
49+
}

0 commit comments

Comments
 (0)