Skip to content

Commit 13e8fa2

Browse files
zerkmsIvan Kurnosov
authored and
Ivan Kurnosov
committed
Make AbstractSchemaManager covariant to its template argument
1 parent cbc2e57 commit 13e8fa2

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
@@ -23,7 +23,7 @@
2323
* Base class for schema managers. Schema managers are used to inspect and/or
2424
* modify the database schema/structure.
2525
*
26-
* @template T of AbstractPlatform
26+
* @template-covariant T of AbstractPlatform
2727
*/
2828
abstract class AbstractSchemaManager
2929
{
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)