Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AbstractSchemaManager covariant to its template argument #6334

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
}
Loading