Unverified Commit ab424a1d authored by Sergei Morozov's avatar Sergei Morozov

Merge pull request #3562 from morozov/platform-types

Enforced parameter and return value types in Platform classes
parents c30aac35 a3e53e97
...@@ -83,7 +83,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver ...@@ -83,7 +83,7 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
{ {
$params = $conn->getParams(); $params = $conn->getParams();
return $params['path'] ?? null; return $params['path'] ?? '';
} }
/** /**
......
This diff is collapsed.
...@@ -12,7 +12,7 @@ class DB2Keywords extends KeywordList ...@@ -12,7 +12,7 @@ class DB2Keywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'DB2'; return 'DB2';
} }
...@@ -20,7 +20,7 @@ class DB2Keywords extends KeywordList ...@@ -20,7 +20,7 @@ class DB2Keywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ACTIVATE', 'ACTIVATE',
......
...@@ -18,12 +18,8 @@ abstract class KeywordList ...@@ -18,12 +18,8 @@ abstract class KeywordList
/** /**
* Checks if the given word is a keyword of this dialect/vendor platform. * Checks if the given word is a keyword of this dialect/vendor platform.
*
* @param string $word
*
* @return bool
*/ */
public function isKeyword($word) public function isKeyword(string $word) : bool
{ {
if ($this->keywords === null) { if ($this->keywords === null) {
$this->initializeKeywords(); $this->initializeKeywords();
...@@ -32,10 +28,7 @@ abstract class KeywordList ...@@ -32,10 +28,7 @@ abstract class KeywordList
return isset($this->keywords[strtoupper($word)]); return isset($this->keywords[strtoupper($word)]);
} }
/** protected function initializeKeywords() : void
* @return void
*/
protected function initializeKeywords()
{ {
$this->keywords = array_flip(array_map('strtoupper', $this->getKeywords())); $this->keywords = array_flip(array_map('strtoupper', $this->getKeywords()));
} }
...@@ -45,12 +38,10 @@ abstract class KeywordList ...@@ -45,12 +38,10 @@ abstract class KeywordList
* *
* @return string[] * @return string[]
*/ */
abstract protected function getKeywords(); abstract protected function getKeywords() : array;
/** /**
* Returns the name of this keyword list. * Returns the name of this keyword list.
*
* @return string
*/ */
abstract public function getName(); abstract public function getName() : string;
} }
...@@ -12,7 +12,7 @@ class MySQL57Keywords extends MySQLKeywords ...@@ -12,7 +12,7 @@ class MySQL57Keywords extends MySQLKeywords
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'MySQL57'; return 'MySQL57';
} }
...@@ -22,7 +22,7 @@ class MySQL57Keywords extends MySQLKeywords ...@@ -22,7 +22,7 @@ class MySQL57Keywords extends MySQLKeywords
* *
* @link http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-7.html * @link http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-7.html
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ACCESSIBLE', 'ACCESSIBLE',
......
...@@ -14,7 +14,7 @@ class MySQL80Keywords extends MySQL57Keywords ...@@ -14,7 +14,7 @@ class MySQL80Keywords extends MySQL57Keywords
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'MySQL80'; return 'MySQL80';
} }
...@@ -24,7 +24,7 @@ class MySQL80Keywords extends MySQL57Keywords ...@@ -24,7 +24,7 @@ class MySQL80Keywords extends MySQL57Keywords
* *
* @link https://dev.mysql.com/doc/refman/8.0/en/keywords.html * @link https://dev.mysql.com/doc/refman/8.0/en/keywords.html
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
$keywords = parent::getKeywords(); $keywords = parent::getKeywords();
......
...@@ -12,7 +12,7 @@ class MySQLKeywords extends KeywordList ...@@ -12,7 +12,7 @@ class MySQLKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'MySQL'; return 'MySQL';
} }
...@@ -20,7 +20,7 @@ class MySQLKeywords extends KeywordList ...@@ -20,7 +20,7 @@ class MySQLKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ACCESSIBLE', 'ACCESSIBLE',
......
...@@ -12,7 +12,7 @@ class OracleKeywords extends KeywordList ...@@ -12,7 +12,7 @@ class OracleKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'Oracle'; return 'Oracle';
} }
...@@ -20,7 +20,7 @@ class OracleKeywords extends KeywordList ...@@ -20,7 +20,7 @@ class OracleKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ACCESS', 'ACCESS',
......
...@@ -15,7 +15,7 @@ class PostgreSQL94Keywords extends PostgreSQLKeywords ...@@ -15,7 +15,7 @@ class PostgreSQL94Keywords extends PostgreSQLKeywords
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'PostgreSQL94'; return 'PostgreSQL94';
} }
...@@ -25,7 +25,7 @@ class PostgreSQL94Keywords extends PostgreSQLKeywords ...@@ -25,7 +25,7 @@ class PostgreSQL94Keywords extends PostgreSQLKeywords
* *
* @link http://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html * @link http://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
$parentKeywords = array_diff(parent::getKeywords(), ['OVER']); $parentKeywords = array_diff(parent::getKeywords(), ['OVER']);
......
...@@ -12,7 +12,7 @@ class PostgreSQLKeywords extends KeywordList ...@@ -12,7 +12,7 @@ class PostgreSQLKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'PostgreSQL'; return 'PostgreSQL';
} }
...@@ -20,7 +20,7 @@ class PostgreSQLKeywords extends KeywordList ...@@ -20,7 +20,7 @@ class PostgreSQLKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ALL', 'ALL',
......
...@@ -33,17 +33,15 @@ class ReservedKeywordsValidator implements Visitor ...@@ -33,17 +33,15 @@ class ReservedKeywordsValidator implements Visitor
/** /**
* @return string[] * @return string[]
*/ */
public function getViolations() public function getViolations() : array
{ {
return $this->violations; return $this->violations;
} }
/** /**
* @param string $word
*
* @return string[] * @return string[]
*/ */
private function isReservedWord($word) private function isReservedWord(string $word) : array
{ {
if ($word[0] === '`') { if ($word[0] === '`') {
$word = str_replace('`', '', $word); $word = str_replace('`', '', $word);
...@@ -62,12 +60,9 @@ class ReservedKeywordsValidator implements Visitor ...@@ -62,12 +60,9 @@ class ReservedKeywordsValidator implements Visitor
} }
/** /**
* @param string $asset
* @param string[] $violatedPlatforms * @param string[] $violatedPlatforms
*
* @return void
*/ */
private function addViolation($asset, $violatedPlatforms) private function addViolation(string $asset, array $violatedPlatforms) : void
{ {
if (! $violatedPlatforms) { if (! $violatedPlatforms) {
return; return;
...@@ -79,7 +74,7 @@ class ReservedKeywordsValidator implements Visitor ...@@ -79,7 +74,7 @@ class ReservedKeywordsValidator implements Visitor
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptColumn(Table $table, Column $column) public function acceptColumn(Table $table, Column $column) : void
{ {
$this->addViolation( $this->addViolation(
'Table ' . $table->getName() . ' column ' . $column->getName(), 'Table ' . $table->getName() . ' column ' . $column->getName(),
...@@ -90,35 +85,35 @@ class ReservedKeywordsValidator implements Visitor ...@@ -90,35 +85,35 @@ class ReservedKeywordsValidator implements Visitor
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptIndex(Table $table, Index $index) public function acceptIndex(Table $table, Index $index) : void
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptSchema(Schema $schema) public function acceptSchema(Schema $schema) : void
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptSequence(Sequence $sequence) public function acceptSequence(Sequence $sequence) : void
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function acceptTable(Table $table) public function acceptTable(Table $table) : void
{ {
$this->addViolation( $this->addViolation(
'Table ' . $table->getName(), 'Table ' . $table->getName(),
......
...@@ -12,7 +12,7 @@ class SQLAnywhereKeywords extends KeywordList ...@@ -12,7 +12,7 @@ class SQLAnywhereKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'SQLAnywhere'; return 'SQLAnywhere';
} }
...@@ -22,7 +22,7 @@ class SQLAnywhereKeywords extends KeywordList ...@@ -22,7 +22,7 @@ class SQLAnywhereKeywords extends KeywordList
* *
* @link http://infocenter.sybase.com/help/topic/com.sybase.dbrfen10/pdf/dbrfen10.pdf?noframes=true * @link http://infocenter.sybase.com/help/topic/com.sybase.dbrfen10/pdf/dbrfen10.pdf?noframes=true
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ADD', 'ADD',
......
...@@ -16,7 +16,7 @@ class SQLServer2012Keywords extends SQLServerKeywords ...@@ -16,7 +16,7 @@ class SQLServer2012Keywords extends SQLServerKeywords
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'SQLServer2012'; return 'SQLServer2012';
} }
...@@ -26,7 +26,7 @@ class SQLServer2012Keywords extends SQLServerKeywords ...@@ -26,7 +26,7 @@ class SQLServer2012Keywords extends SQLServerKeywords
* *
* @link http://msdn.microsoft.com/en-us/library/ms189822.aspx * @link http://msdn.microsoft.com/en-us/library/ms189822.aspx
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return array_merge(parent::getKeywords(), [ return array_merge(parent::getKeywords(), [
'SEMANTICKEYPHRASETABLE', 'SEMANTICKEYPHRASETABLE',
......
...@@ -14,7 +14,7 @@ class SQLServerKeywords extends KeywordList ...@@ -14,7 +14,7 @@ class SQLServerKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'SQLServer'; return 'SQLServer';
} }
...@@ -24,7 +24,7 @@ class SQLServerKeywords extends KeywordList ...@@ -24,7 +24,7 @@ class SQLServerKeywords extends KeywordList
* *
* @link http://msdn.microsoft.com/en-us/library/aa238507%28v=sql.80%29.aspx * @link http://msdn.microsoft.com/en-us/library/aa238507%28v=sql.80%29.aspx
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ADD', 'ADD',
......
...@@ -12,7 +12,7 @@ class SQLiteKeywords extends KeywordList ...@@ -12,7 +12,7 @@ class SQLiteKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getName() public function getName() : string
{ {
return 'SQLite'; return 'SQLite';
} }
...@@ -20,7 +20,7 @@ class SQLiteKeywords extends KeywordList ...@@ -20,7 +20,7 @@ class SQLiteKeywords extends KeywordList
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getKeywords() protected function getKeywords() : array
{ {
return [ return [
'ABORT', 'ABORT',
......
...@@ -16,7 +16,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -16,7 +16,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function hasNativeJsonType() public function hasNativeJsonType() : bool
{ {
return true; return true;
} }
...@@ -24,7 +24,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -24,7 +24,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getJsonTypeDeclarationSQL(array $field) public function getJsonTypeDeclarationSQL(array $field) : string
{ {
return 'JSON'; return 'JSON';
} }
...@@ -32,7 +32,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -32,7 +32,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) : array
{ {
return []; return [];
} }
...@@ -40,7 +40,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -40,7 +40,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) : array
{ {
return []; return [];
} }
...@@ -48,7 +48,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -48,7 +48,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) protected function getRenameIndexSQL(string $oldIndexName, Index $index, string $tableName) : array
{ {
return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)]; return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)];
} }
...@@ -56,7 +56,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -56,7 +56,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass() : string
{ {
return Keywords\MySQL57Keywords::class; return Keywords\MySQL57Keywords::class;
} }
...@@ -64,7 +64,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -64,7 +64,7 @@ class MySQL57Platform extends MySqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings() : void
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
......
...@@ -12,7 +12,7 @@ class MySQL80Platform extends MySQL57Platform ...@@ -12,7 +12,7 @@ class MySQL80Platform extends MySQL57Platform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass() : string
{ {
return Keywords\MySQL80Keywords::class; return Keywords\MySQL80Keywords::class;
} }
......
...@@ -19,7 +19,7 @@ class PostgreSQL100Platform extends PostgreSQL94Platform ...@@ -19,7 +19,7 @@ class PostgreSQL100Platform extends PostgreSQL94Platform
return PostgreSQL100Keywords::class; return PostgreSQL100Keywords::class;
} }
public function getListSequencesSQL($database) : string public function getListSequencesSQL(string $database) : string
{ {
return 'SELECT sequence_name AS relname, return 'SELECT sequence_name AS relname,
sequence_schema AS schemaname, sequence_schema AS schemaname,
......
...@@ -13,8 +13,10 @@ class PostgreSQL94Platform extends PostgreSqlPlatform ...@@ -13,8 +13,10 @@ class PostgreSQL94Platform extends PostgreSqlPlatform
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @return string
*/ */
public function getJsonTypeDeclarationSQL(array $field) public function getJsonTypeDeclarationSQL(array $field) : string
{ {
if (! empty($field['jsonb'])) { if (! empty($field['jsonb'])) {
return 'JSONB'; return 'JSONB';
...@@ -26,7 +28,7 @@ class PostgreSQL94Platform extends PostgreSqlPlatform ...@@ -26,7 +28,7 @@ class PostgreSQL94Platform extends PostgreSqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass() : string
{ {
return Keywords\PostgreSQL94Keywords::class; return Keywords\PostgreSQL94Keywords::class;
} }
...@@ -34,7 +36,7 @@ class PostgreSQL94Platform extends PostgreSqlPlatform ...@@ -34,7 +36,7 @@ class PostgreSQL94Platform extends PostgreSqlPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings() : void
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
......
...@@ -18,7 +18,7 @@ class SQLAzurePlatform extends SQLServerPlatform ...@@ -18,7 +18,7 @@ class SQLAzurePlatform extends SQLServerPlatform
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES) public function getCreateTableSQL(Table $table, int $createFlags = self::CREATE_INDEXES) : array
{ {
$sql = parent::getCreateTableSQL($table, $createFlags); $sql = parent::getCreateTableSQL($table, $createFlags);
......
...@@ -22,7 +22,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -22,7 +22,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getAlterSequenceSQL(Sequence $sequence) public function getAlterSequenceSQL(Sequence $sequence) : string
{ {
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) . return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
' INCREMENT BY ' . $sequence->getAllocationSize(); ' INCREMENT BY ' . $sequence->getAllocationSize();
...@@ -31,7 +31,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -31,7 +31,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getCreateSequenceSQL(Sequence $sequence) public function getCreateSequenceSQL(Sequence $sequence) : string
{ {
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) . return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
' START WITH ' . $sequence->getInitialValue() . ' START WITH ' . $sequence->getInitialValue() .
...@@ -42,7 +42,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -42,7 +42,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getDropSequenceSQL($sequence) public function getDropSequenceSQL($sequence) : string
{ {
if ($sequence instanceof Sequence) { if ($sequence instanceof Sequence) {
$sequence = $sequence->getQuotedName($this); $sequence = $sequence->getQuotedName($this);
...@@ -54,7 +54,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -54,7 +54,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getListSequencesSQL($database) public function getListSequencesSQL(string $database) : string
{ {
return 'SELECT seq.name, return 'SELECT seq.name,
CAST( CAST(
...@@ -69,7 +69,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -69,7 +69,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSequenceNextValSQL($sequenceName) public function getSequenceNextValSQL(string $sequenceName) : string
{ {
return 'SELECT NEXT VALUE FOR ' . $sequenceName; return 'SELECT NEXT VALUE FOR ' . $sequenceName;
} }
...@@ -77,7 +77,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -77,7 +77,7 @@ class SQLServer2012Platform extends SQLServerPlatform
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsSequences() public function supportsSequences() : bool
{ {
return true; return true;
} }
...@@ -87,7 +87,7 @@ class SQLServer2012Platform extends SQLServerPlatform ...@@ -87,7 +87,7 @@ class SQLServer2012Platform extends SQLServerPlatform
* *
* Returns Microsoft SQL Server 2012 specific keywords class * Returns Microsoft SQL Server 2012 specific keywords class
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass() : string
{ {
return Keywords\SQLServer2012Keywords::class; return Keywords\SQLServer2012Keywords::class;
} }
......
...@@ -26,6 +26,14 @@ class DriverTest extends AbstractDriverTest ...@@ -26,6 +26,14 @@ class DriverTest extends AbstractDriverTest
$this->markTestSkipped('pdo_sqlite only test.'); $this->markTestSkipped('pdo_sqlite only test.');
} }
/**
* {@inheritdoc}
*/
public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('SQLite does not support the concept of a database.');
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -1062,12 +1062,9 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -1062,12 +1062,9 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$table = new Table('col_def_lifecycle'); $table = new Table('col_def_lifecycle');
$table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('column1', 'string', ['default' => null]); $table->addColumn('column1', 'string', ['default' => null]);
$table->addColumn('column2', 'string', ['default' => false]); $table->addColumn('column2', 'string', ['default' => '']);
$table->addColumn('column3', 'string', ['default' => true]); $table->addColumn('column3', 'string', ['default' => 'default1']);
$table->addColumn('column4', 'string', ['default' => 0]); $table->addColumn('column4', 'integer', ['default' => 0]);
$table->addColumn('column5', 'string', ['default' => '']);
$table->addColumn('column6', 'string', ['default' => 'def']);
$table->addColumn('column7', 'integer', ['default' => 0]);
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$this->schemaManager->dropAndCreateTable($table); $this->schemaManager->dropAndCreateTable($table);
...@@ -1077,21 +1074,15 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -1077,21 +1074,15 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
self::assertNull($columns['id']->getDefault()); self::assertNull($columns['id']->getDefault());
self::assertNull($columns['column1']->getDefault()); self::assertNull($columns['column1']->getDefault());
self::assertSame('', $columns['column2']->getDefault()); self::assertSame('', $columns['column2']->getDefault());
self::assertSame('1', $columns['column3']->getDefault()); self::assertSame('default1', $columns['column3']->getDefault());
self::assertSame('0', $columns['column4']->getDefault()); self::assertSame('0', $columns['column4']->getDefault());
self::assertSame('', $columns['column5']->getDefault());
self::assertSame('def', $columns['column6']->getDefault());
self::assertSame('0', $columns['column7']->getDefault());
$diffTable = clone $table; $diffTable = clone $table;
$diffTable->changeColumn('column1', ['default' => false]); $diffTable->changeColumn('column1', ['default' => '']);
$diffTable->changeColumn('column2', ['default' => null]); $diffTable->changeColumn('column2', ['default' => null]);
$diffTable->changeColumn('column3', ['default' => false]); $diffTable->changeColumn('column3', ['default' => 'default2']);
$diffTable->changeColumn('column4', ['default' => null]); $diffTable->changeColumn('column4', ['default' => null]);
$diffTable->changeColumn('column5', ['default' => false]);
$diffTable->changeColumn('column6', ['default' => 666]);
$diffTable->changeColumn('column7', ['default' => null]);
$comparator = new Comparator(); $comparator = new Comparator();
...@@ -1101,11 +1092,8 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -1101,11 +1092,8 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
self::assertSame('', $columns['column1']->getDefault()); self::assertSame('', $columns['column1']->getDefault());
self::assertNull($columns['column2']->getDefault()); self::assertNull($columns['column2']->getDefault());
self::assertSame('', $columns['column3']->getDefault()); self::assertSame('default2', $columns['column3']->getDefault());
self::assertNull($columns['column4']->getDefault()); self::assertNull($columns['column4']->getDefault());
self::assertSame('', $columns['column5']->getDefault());
self::assertSame('666', $columns['column6']->getDefault());
self::assertNull($columns['column7']->getDefault());
} }
public function testListTableWithBinary() : void public function testListTableWithBinary() : void
......
...@@ -246,10 +246,10 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -246,10 +246,10 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
public function testGeneratesForeignKeyCreationSql() : void public function testGeneratesForeignKeyCreationSql() : void
{ {
$fk = new ForeignKeyConstraint(['fk_name_id'], 'other_table', ['id'], ''); $fk = new ForeignKeyConstraint(['fk_name_id'], 'other_table', ['id']);
$sql = $this->platform->getCreateForeignKeySQL($fk, 'test'); $sql = $this->platform->getCreateForeignKeySQL($fk, 'test');
self::assertEquals($sql, $this->getGenerateForeignKeySql()); self::assertEquals($this->getGenerateForeignKeySql(), $sql);
} }
abstract public function getGenerateForeignKeySql() : string; abstract public function getGenerateForeignKeySql() : string;
......
...@@ -1032,9 +1032,9 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas ...@@ -1032,9 +1032,9 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
$tableDiff->changedColumns['col_string'] = new ColumnDiff( $tableDiff->changedColumns['col_string'] = new ColumnDiff(
'col_string', 'col_string',
new Column('col_string', Type::getType('string'), ['default' => 666, 'fixed' => true]), new Column('col_string', Type::getType('string'), ['default' => 'foo', 'fixed' => true]),
['fixed'], ['fixed'],
new Column('col_string', Type::getType('string'), ['default' => 666]) new Column('col_string', Type::getType('string'), ['default' => 'foo'])
); );
$expected = $this->platform->getAlterTableSQL($tableDiff); $expected = $this->platform->getAlterTableSQL($tableDiff);
...@@ -1047,7 +1047,7 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas ...@@ -1047,7 +1047,7 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
'ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_FA2CB292 DEFAULT 666 FOR col_int', 'ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_FA2CB292 DEFAULT 666 FOR col_int',
'ALTER TABLE column_def_change_type DROP CONSTRAINT DF_829302E0_2725A6D0', 'ALTER TABLE column_def_change_type DROP CONSTRAINT DF_829302E0_2725A6D0',
'ALTER TABLE column_def_change_type ALTER COLUMN col_string NCHAR(255) NOT NULL', 'ALTER TABLE column_def_change_type ALTER COLUMN col_string NCHAR(255) NOT NULL',
"ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_2725A6D0 DEFAULT '666' FOR col_string", "ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_2725A6D0 DEFAULT 'foo' FOR col_string",
] ]
); );
} }
......
...@@ -253,8 +253,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase ...@@ -253,8 +253,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
{ {
return [ return [
[null, ''], [null, ''],
[false, ''],
[true, ''],
[LockMode::NONE, ' WITH (NOLOCK)'], [LockMode::NONE, ' WITH (NOLOCK)'],
[LockMode::OPTIMISTIC, ''], [LockMode::OPTIMISTIC, ''],
[LockMode::PESSIMISTIC_READ, ' WITH (UPDLOCK)'], [LockMode::PESSIMISTIC_READ, ' WITH (UPDLOCK)'],
...@@ -757,13 +755,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase ...@@ -757,13 +755,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
); );
} }
public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getSetTransactionIsolationSQL('invalid_transaction_isolation_level');
}
public function testModifiesLimitQuery() : void public function testModifiesLimitQuery() : void
{ {
self::assertEquals( self::assertEquals(
...@@ -916,10 +907,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase ...@@ -916,10 +907,6 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
'SELECT myseq.NEXTVAL', 'SELECT myseq.NEXTVAL',
$this->platform->getSequenceNextValSQL('myseq') $this->platform->getSequenceNextValSQL('myseq')
); );
self::assertEquals(
'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE',
$this->platform->getListSequencesSQL(null)
);
} }
public function testDoesNotSupportInlineColumnComments() : void public function testDoesNotSupportInlineColumnComments() : void
......
...@@ -45,8 +45,6 @@ class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase ...@@ -45,8 +45,6 @@ class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
{ {
return [ return [
[null, ''], [null, ''],
[false, ''],
[true, ''],
[LockMode::NONE, ' WITH (NOLOCK)'], [LockMode::NONE, ' WITH (NOLOCK)'],
[LockMode::OPTIMISTIC, ''], [LockMode::OPTIMISTIC, ''],
[LockMode::PESSIMISTIC_READ, ' WITH (HOLDLOCK, ROWLOCK)'], [LockMode::PESSIMISTIC_READ, ' WITH (HOLDLOCK, ROWLOCK)'],
......
...@@ -688,7 +688,7 @@ class SqlitePlatformTest extends AbstractPlatformTestCase ...@@ -688,7 +688,7 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
protected static function getInlineColumnEmptyCommentSQL() : string protected static function getInlineColumnEmptyCommentSQL() : string
{ {
return "--\n"; return '';
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment