Skip to content

Commit 8a7e9b7

Browse files
authored
Merge pull request #6334 from zerkms/patch-2
Make AbstractSchemaManager covariant to its template argument
2 parents 98c5b03 + f5d3777 commit 8a7e9b7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Schema/AbstractSchemaManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Base class for schema managers. Schema managers are used to inspect and/or
3232
* modify the database schema/structure.
3333
*
34-
* @template T of AbstractPlatform
34+
* @template-covariant T of AbstractPlatform
3535
*/
3636
abstract class AbstractSchemaManager
3737
{
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\StaticAnalysis\DBAL;
6+
7+
use Doctrine\DBAL\Connection;
8+
use Doctrine\DBAL\Driver\PDO\PgSQL\Driver;
9+
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
10+
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
11+
use Exception;
12+
13+
$smf = new DefaultSchemaManagerFactory();
14+
$schemaManager = $smf->createSchemaManager(new Connection([], new Driver()));
15+
16+
if (!$schemaManager instanceof PostgreSQLSchemaManager) {
17+
throw new Exception('should not happen');
18+
}

0 commit comments

Comments
 (0)