Skip to content

Commit f5d3777

Browse files
zerkmsIvan Kurnosov
authored and
Ivan Kurnosov
committed
Make AbstractSchemaManager covariant to its template argument
1 parent 98c5b03 commit f5d3777

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Schema/AbstractSchemaManager.php

+1-1
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
{
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)