diff --git a/psalm.xml.dist b/psalm.xml.dist index 183443139bf..9fabad3812d 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -77,6 +77,8 @@ + + diff --git a/src/Configuration.php b/src/Configuration.php index 7c50ce83e30..9aa001db483 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -5,6 +5,7 @@ namespace Doctrine\DBAL; use Doctrine\DBAL\Driver\Middleware; +use Doctrine\DBAL\Exception\InvalidArgumentException; use Doctrine\DBAL\Schema\SchemaManagerFactory; use Psr\Cache\CacheItemPoolInterface; @@ -33,14 +34,6 @@ class Configuration */ protected bool $autoCommit = true; - /** - * Whether type comments should be disabled to provide the same DB schema than - * will be obtained with DBAL 4.x. This is useful when relying only on the - * platform-aware schema comparison (which does not need those type comments) - * rather than the deprecated legacy tooling. - */ - private bool $disableTypeComments = false; - private ?SchemaManagerFactory $schemaManagerFactory = null; public function __construct() @@ -141,15 +134,22 @@ public function setSchemaManagerFactory(SchemaManagerFactory $schemaManagerFacto return $this; } + /** @return true */ public function getDisableTypeComments(): bool { - return $this->disableTypeComments; + return true; } - /** @return $this */ + /** + * @param true $disableTypeComments + * + * @return $this + */ public function setDisableTypeComments(bool $disableTypeComments): self { - $this->disableTypeComments = $disableTypeComments; + if (! $disableTypeComments) { + throw new InvalidArgumentException('Column comments cannot be enabled anymore.'); + } return $this; } diff --git a/src/Connection.php b/src/Connection.php index 3a25dd5804e..380f2a7a0c8 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -188,7 +188,6 @@ public function getDatabasePlatform(): AbstractPlatform } $this->platform = $this->driver->getDatabasePlatform($versionProvider); - $this->platform->setDisableTypeComments($this->_config->getDisableTypeComments()); } return $this->platform; diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 360501816e1..3959e2fa295 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -81,14 +81,6 @@ abstract class AbstractPlatform */ protected ?KeywordList $_keywords = null; - private bool $disableTypeComments = false; - - /** @internal */ - final public function setDisableTypeComments(bool $value): void - { - $this->disableTypeComments = $value; - } - /** * Returns the SQL snippet that declares a boolean column. *