Skip to content

Commit

Permalink
Mark internal platform methods as protected
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Dec 26, 2024
1 parent 98a18fd commit a92139f
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 497 deletions.
12 changes: 4 additions & 8 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,12 @@ public function supportsIdentityColumns(): bool
return true;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsInlineColumnComments(): bool
protected function supportsInlineColumnComments(): bool
{
return true;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsColumnCollation(): bool
protected function supportsColumnCollation(): bool
{
return true;
}
Expand Down Expand Up @@ -677,14 +675,12 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column): string
return $this->getUnsignedDeclaration($column) . $autoinc;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getColumnCharsetDeclarationSQL(string $charset): string
protected function getColumnCharsetDeclarationSQL(string $charset): string
{
return 'CHARACTER SET ' . $charset;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
protected function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
{
$query = '';
if ($foreignKey->hasOption('match')) {
Expand Down
63 changes: 15 additions & 48 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,6 @@ public function getDropIndexSQL(string $name, string $table): string

/**
* Returns the SQL to drop a constraint.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
protected function getDropConstraintSQL(string $name, string $table): string
{
Expand Down Expand Up @@ -790,11 +788,7 @@ public function createUnionSQLBuilder(): UnionSQLBuilder
return new DefaultUnionSQLBuilder($this);
}

/**
* @internal
*
* @return list<string>
*/
/** @return list<string> */
final protected function getCreateTableWithoutForeignKeysSQL(Table $table): array
{
return $this->buildCreateTableSQL($table, false);
Expand Down Expand Up @@ -930,8 +924,7 @@ protected function getCommentOnTableSQL(string $tableName, string $comment): str
);
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getCommentOnColumnSQL(string $tableName, string $columnName, string $comment): string
protected function getCommentOnColumnSQL(string $tableName, string $columnName, string $comment): string
{
$tableName = new Identifier($tableName);
$columnName = new Identifier($columnName);
Expand All @@ -946,10 +939,8 @@ public function getCommentOnColumnSQL(string $tableName, string $columnName, str

/**
* Returns the SQL to create inline comment on a column.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getInlineColumnCommentSQL(string $comment): string
protected function getInlineColumnCommentSQL(string $comment): string
{
if (! $this->supportsInlineColumnComments()) {
throw NotSupported::new(__METHOD__);
Expand Down Expand Up @@ -1334,8 +1325,6 @@ public function getColumnDeclarationListSQL(array $columns): string
* Obtains DBMS specific SQL code portion needed to declare a generic type
* column to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param string $name The name the column to be declared.
* @param mixed[] $column An associative array with the name of the properties
* of the column being declared as array indexes. Currently, the types
Expand All @@ -1359,7 +1348,7 @@ public function getColumnDeclarationListSQL(array $columns): string
*
* @return string DBMS specific SQL code portion that should be used to declare the column.
*/
public function getColumnDeclarationSQL(string $name, array $column): string
protected function getColumnDeclarationSQL(string $name, array $column): string
{
if (isset($column['columnDefinition'])) {
$declaration = $column['columnDefinition'];
Expand Down Expand Up @@ -1411,13 +1400,11 @@ public function getDecimalTypeDeclarationSQL(array $column): string
* Obtains DBMS specific SQL code portion needed to set a default value
* declaration to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param mixed[] $column The column definition array.
*
* @return string DBMS specific SQL code portion needed to set a default value.
*/
public function getDefaultValueDeclarationSQL(array $column): string
protected function getDefaultValueDeclarationSQL(array $column): string
{
if (! isset($column['default'])) {
return empty($column['notnull']) ? ' DEFAULT NULL' : '';
Expand Down Expand Up @@ -1525,13 +1512,11 @@ public function getUniqueConstraintDeclarationSQL(UniqueConstraint $constraint):
* Obtains DBMS specific SQL code portion needed to set an index
* declaration to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param Index $index The index definition.
*
* @return string DBMS specific SQL code portion needed to set an index.
*/
public function getIndexDeclarationSQL(Index $index): string
protected function getIndexDeclarationSQL(Index $index): string
{
$columns = $index->getColumns();

Expand All @@ -1555,12 +1540,10 @@ public function getTemporaryTableName(string $tableName): string
* Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a column declaration to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @return string DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
* of a column declaration.
*/
public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey): string
protected function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey): string
{
$sql = $this->getForeignKeyBaseDeclarationSQL($foreignKey);
$sql .= $this->getAdvancedForeignKeyOptionsSQL($foreignKey);
Expand All @@ -1572,11 +1555,9 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey): s
* Returns the FOREIGN KEY query section dealing with non-standard options
* as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param ForeignKeyConstraint $foreignKey The foreign key definition.
*/
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
protected function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
{
$query = '';
if ($foreignKey->hasOption('onUpdate')) {
Expand All @@ -1593,11 +1574,9 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey
/**
* Returns the given referential action in uppercase if valid, otherwise throws an exception.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param string $action The foreign key referential action.
*/
public function getForeignKeyReferentialActionSQL(string $action): string
protected function getForeignKeyReferentialActionSQL(string $action): string
{
$upper = strtoupper($action);

Expand Down Expand Up @@ -1646,14 +1625,12 @@ public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey
* Obtains DBMS specific SQL code portion needed to set the CHARACTER SET
* of a column declaration to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param string $charset The name of the charset.
*
* @return string DBMS specific SQL code portion needed to set the CHARACTER SET
* of a column declaration.
*/
public function getColumnCharsetDeclarationSQL(string $charset): string
protected function getColumnCharsetDeclarationSQL(string $charset): string

Check warning on line 1633 in src/Platforms/AbstractPlatform.php

View check run for this annotation

Codecov / codecov/patch

src/Platforms/AbstractPlatform.php#L1633

Added line #L1633 was not covered by tests
{
return '';
}
Expand All @@ -1662,14 +1639,12 @@ public function getColumnCharsetDeclarationSQL(string $charset): string
* Obtains DBMS specific SQL code portion needed to set the COLLATION
* of a column declaration to be used in statements like CREATE TABLE.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @param string $collation The name of the collation.
*
* @return string DBMS specific SQL code portion needed to set the COLLATION
* of a column declaration.
*/
public function getColumnCollationDeclarationSQL(string $collation): string
protected function getColumnCollationDeclarationSQL(string $collation): string
{
return $this->supportsColumnCollation() ? 'COLLATE ' . $this->quoteSingleIdentifier($collation) : '';
}
Expand Down Expand Up @@ -1915,10 +1890,8 @@ public function supportsIdentityColumns(): bool

/**
* Whether the platform supports partial indexes.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function supportsPartialIndexes(): bool
protected function supportsPartialIndexes(): bool
{
return false;
}
Expand Down Expand Up @@ -1957,30 +1930,24 @@ public function supportsSchemas(): bool

/**
* Whether this platform support to add inline column comments as postfix.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function supportsInlineColumnComments(): bool
protected function supportsInlineColumnComments(): bool
{
return false;
}

/**
* Whether this platform support the proprietary syntax "COMMENT ON asset".
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function supportsCommentOnStatement(): bool
protected function supportsCommentOnStatement(): bool
{
return false;
}

/**
* Does this platform support column collation?
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function supportsColumnCollation(): bool
protected function supportsColumnCollation(): bool

Check warning on line 1950 in src/Platforms/AbstractPlatform.php

View check run for this annotation

Codecov / codecov/patch

src/Platforms/AbstractPlatform.php#L1950

Added line #L1950 was not covered by tests
{
return false;
}
Expand Down
10 changes: 3 additions & 7 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ public function getListViewsSQL(string $database): string
return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS';
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsCommentOnStatement(): bool
protected function supportsCommentOnStatement(): bool
{
return true;
}
Expand All @@ -227,8 +226,7 @@ public function getCurrentTimestampSQL(): string
return 'CURRENT TIMESTAMP';
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getIndexDeclarationSQL(Index $index): string
protected function getIndexDeclarationSQL(Index $index): string

Check warning on line 229 in src/Platforms/DB2Platform.php

View check run for this annotation

Codecov / codecov/patch

src/Platforms/DB2Platform.php#L229

Added line #L229 was not covered by tests
{
// Index declaration in statements like CREATE TABLE is not supported.
throw NotSupported::new(__METHOD__);
Expand Down Expand Up @@ -488,10 +486,8 @@ protected function getRenameIndexSQL(string $oldIndexName, Index $index, string

/**
* {@inheritDoc}
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getDefaultValueDeclarationSQL(array $column): string
protected function getDefaultValueDeclarationSQL(array $column): string
{
if (isset($column['autoincrement']) && $column['autoincrement'] === true) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/Platforms/MariaDBPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getColumnTypeSQLSnippet(string $tableAlias, string $databaseName
}

/** {@inheritDoc} */
public function getColumnDeclarationSQL(string $name, array $column): string
protected function getColumnDeclarationSQL(string $name, array $column): string
{
// MariaDb forces column collation to utf8mb4_bin where the column was declared as JSON so ignore
// collation and character set for json columns as attempting to set them can cause an error.
Expand Down
4 changes: 1 addition & 3 deletions src/Platforms/MySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ class MySQLPlatform extends AbstractMySQLPlatform
*
* Oracle MySQL does not support default values on TEXT/BLOB columns until 8.0.13.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*
* @link https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-13.html#mysqld-8-0-13-data-types
*/
public function getDefaultValueDeclarationSQL(array $column): string
protected function getDefaultValueDeclarationSQL(array $column): string
{
if ($column['type'] instanceof TextType || $column['type'] instanceof BlobType) {
unset($column['default']);
Expand Down
13 changes: 4 additions & 9 deletions src/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@ public function getDropForeignKeySQL(string $foreignKey, string $table): string
return $this->getDropConstraintSQL($foreignKey, $table);
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
protected function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
{
$referentialAction = '';

Expand All @@ -493,8 +492,7 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey
return '';
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getForeignKeyReferentialActionSQL(string $action): string
protected function getForeignKeyReferentialActionSQL(string $action): string
{
$action = strtoupper($action);

Expand Down Expand Up @@ -630,10 +628,8 @@ public function getAlterTableSQL(TableDiff $diff): array

/**
* {@inheritDoc}
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getColumnDeclarationSQL(string $name, array $column): string
protected function getColumnDeclarationSQL(string $name, array $column): string
{
if (isset($column['columnDefinition'])) {
$declaration = $column['columnDefinition'];
Expand Down Expand Up @@ -682,8 +678,7 @@ protected function getIdentitySequenceName(string $tableName): string
return $identitySequenceIdentifier->getQuotedName($this);
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsCommentOnStatement(): bool
protected function supportsCommentOnStatement(): bool
{
return true;
}
Expand Down
16 changes: 5 additions & 11 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ public function supportsIdentityColumns(): bool
return true;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsPartialIndexes(): bool
protected function supportsPartialIndexes(): bool
{
return true;
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsCommentOnStatement(): bool
protected function supportsCommentOnStatement(): bool
{
return true;
}
Expand Down Expand Up @@ -168,8 +166,7 @@ public function getListViewsSQL(string $database): string
WHERE view_definition IS NOT NULL';
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
protected function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
{
$query = '';

Expand Down Expand Up @@ -738,10 +735,8 @@ public function getBlobTypeDeclarationSQL(array $column): string

/**
* {@inheritDoc}
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getDefaultValueDeclarationSQL(array $column): string
protected function getDefaultValueDeclarationSQL(array $column): string
{
if (isset($column['autoincrement']) && $column['autoincrement'] === true) {
return '';
Expand All @@ -750,8 +745,7 @@ public function getDefaultValueDeclarationSQL(array $column): string
return parent::getDefaultValueDeclarationSQL($column);
}

/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsColumnCollation(): bool
protected function supportsColumnCollation(): bool

Check warning on line 748 in src/Platforms/PostgreSQLPlatform.php

View check run for this annotation

Codecov / codecov/patch

src/Platforms/PostgreSQLPlatform.php#L748

Added line #L748 was not covered by tests
{
return true;
}
Expand Down
Loading

0 comments on commit a92139f

Please sign in to comment.