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

Remove API to disable column comments #6222

Merged
merged 1 commit into from
Nov 19, 2023
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: 2 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
<file name="src/Schema/Column.php"/>
<!-- See https://github.com/vimeo/psalm/issues/5472 -->
<file name="src/Portability/Converter.php"/>
<!-- We're checking for invalid input -->
<file name="src/Configuration.php"/>
</errorLevel>
</DocblockTypeContradiction>
<FalsableReturnStatement>
Expand Down
22 changes: 11 additions & 11 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -33,14 +34,6 @@
*/
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()
Expand Down Expand Up @@ -141,15 +134,22 @@
return $this;
}

/** @return true */
public function getDisableTypeComments(): bool
{
return $this->disableTypeComments;
return true;

Check warning on line 140 in src/Configuration.php

View check run for this annotation

Codecov / codecov/patch

src/Configuration.php#L140

Added line #L140 was not covered by tests
}

/** @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.');

Check warning on line 151 in src/Configuration.php

View check run for this annotation

Codecov / codecov/patch

src/Configuration.php#L150-L151

Added lines #L150 - L151 were not covered by tests
}

return $this;
}
Expand Down
1 change: 0 additions & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public function getDatabasePlatform(): AbstractPlatform
}

$this->platform = $this->driver->getDatabasePlatform($versionProvider);
$this->platform->setDisableTypeComments($this->_config->getDisableTypeComments());
}

return $this->platform;
Expand Down
8 changes: 0 additions & 8 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down