Skip to content

Commit

Permalink
Merge pull request doctrine#6334 from zerkms/patch-2
Browse files Browse the repository at this point in the history
Make AbstractSchemaManager covariant to its template argument
  • Loading branch information
greg0ire authored Aug 1, 2024
2 parents 98c5b03 + f5d3777 commit 8a7e9b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Base class for schema managers. Schema managers are used to inspect and/or
* modify the database schema/structure.
*
* @template T of AbstractPlatform
* @template-covariant T of AbstractPlatform
*/
abstract class AbstractSchemaManager
{
Expand Down
18 changes: 18 additions & 0 deletions static-analysis/abstract-schema-manager-covariant-template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Doctrine\StaticAnalysis\DBAL;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDO\PgSQL\Driver;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Exception;

$smf = new DefaultSchemaManagerFactory();
$schemaManager = $smf->createSchemaManager(new Connection([], new Driver()));

if (!$schemaManager instanceof PostgreSQLSchemaManager) {
throw new Exception('should not happen');
}

0 comments on commit 8a7e9b7

Please sign in to comment.