Replace $thingyName arguments with $name where "thingy" is clear from the context

parent c890d041
......@@ -192,15 +192,15 @@ abstract class AbstractSchemaManager
*
* The usage of a string $tableNames is deprecated. Pass a one-element array instead.
*
* @param string|string[] $tableNames
* @param string|string[] $names
*
* @return bool
*/
public function tablesExist($tableNames)
public function tablesExist($names)
{
$tableNames = array_map('strtolower', (array) $tableNames);
$names = array_map('strtolower', (array) $names);
return count($tableNames) === count(array_intersect($tableNames, array_map('strtolower', $this->listTableNames())));
return count($names) === count(array_intersect($names, array_map('strtolower', $this->listTableNames())));
}
/**
......@@ -264,21 +264,21 @@ abstract class AbstractSchemaManager
}
/**
* @param string $tableName
* @param string $name
*
* @return Table
*/
public function listTableDetails($tableName)
public function listTableDetails($name)
{
$columns = $this->listTableColumns($tableName);
$columns = $this->listTableColumns($name);
$foreignKeys = [];
if ($this->_platform->supportsForeignKeyConstraints()) {
$foreignKeys = $this->listTableForeignKeys($tableName);
$foreignKeys = $this->listTableForeignKeys($name);
}
$indexes = $this->listTableIndexes($tableName);
$indexes = $this->listTableIndexes($name);
return new Table($tableName, $columns, $indexes, $foreignKeys);
return new Table($name, $columns, $indexes, $foreignKeys);
}
/**
......@@ -334,13 +334,13 @@ abstract class AbstractSchemaManager
/**
* Drops the given table.
*
* @param string $tableName The name of the table to drop.
* @param string $name The name of the table to drop.
*
* @return void
*/
public function dropTable($tableName)
public function dropTable($name)
{
$this->_execSql($this->_platform->getDropTableSQL($tableName));
$this->_execSql($this->_platform->getDropTableSQL($name));
}
/**
......
......@@ -59,12 +59,12 @@ class Column extends AbstractAsset
/**
* Creates a new Column.
*
* @param string $columnName
* @param string $name
* @param mixed[] $options
*/
public function __construct($columnName, Type $type, array $options = [])
public function __construct($name, Type $type, array $options = [])
{
$this->_setName($columnName);
$this->_setName($name);
$this->setType($type);
$this->setOptions($options);
}
......
......@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager
/**
* {@inheritdoc}
*/
public function listTableDetails($tableName): Table
public function listTableDetails($name): Table
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$platform = $this->_platform;
assert($platform instanceof DB2Platform);
$sql = $platform->getListTableCommentsSQL($tableName);
$sql = $platform->getListTableCommentsSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql);
......
......@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint
private $options = [];
/**
* @param string $indexName
* @param string $name
* @param string[] $columns
* @param bool $isUnique
* @param bool $isPrimary
* @param string[] $flags
* @param mixed[] $options
*/
public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = [])
public function __construct($name, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = [])
{
$isUnique = $isUnique || $isPrimary;
$this->_setName($indexName);
$this->_setName($name);
$this->_isUnique = $isUnique;
$this->_isPrimary = $isPrimary;
$this->options = $options;
......@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint
}
/**
* @param string $columnName
* @param string $name
* @param int $pos
*
* @return bool
*/
public function hasColumnAtPosition($columnName, $pos = 0)
public function hasColumnAtPosition($name, $pos = 0)
{
$columnName = $this->trimQuotes(strtolower($columnName));
$name = $this->trimQuotes(strtolower($name));
$indexColumns = array_map('strtolower', $this->getUnquotedColumns());
return array_search($columnName, $indexColumns) === $pos;
return array_search($name, $indexColumns) === $pos;
}
/**
......
......@@ -320,13 +320,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
/**
* {@inheritdoc}
*/
public function listTableDetails($tableName)
public function listTableDetails($name)
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$platform = $this->_platform;
assert($platform instanceof MySqlPlatform);
$sql = $platform->getListTableMetadataSQL($tableName);
$sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql);
......
......@@ -400,13 +400,13 @@ SQL;
/**
* {@inheritdoc}
*/
public function listTableDetails($tableName): Table
public function listTableDetails($name): Table
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$platform = $this->_platform;
assert($platform instanceof OraclePlatform);
$sql = $platform->getListTableCommentsSQL($tableName);
$sql = $platform->getListTableCommentsSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql);
......
......@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
/**
* {@inheritdoc}
*/
public function listTableDetails($tableName): Table
public function listTableDetails($name): Table
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$platform = $this->_platform;
assert($platform instanceof PostgreSqlPlatform);
$sql = $platform->getListTableMetadataSQL($tableName);
$sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql);
......
......@@ -331,15 +331,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
}
/**
* @param string $tableName
* @param string $name
*/
public function listTableDetails($tableName): Table
public function listTableDetails($name): Table
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$platform = $this->_platform;
assert($platform instanceof SQLServerPlatform);
$sql = $platform->getListTableMetadataSQL($tableName);
$sql = $platform->getListTableMetadataSQL($name);
$tableOptions = $this->_conn->fetchAssoc($sql);
......
......@@ -165,20 +165,20 @@ class Schema extends AbstractAsset
}
/**
* @param string $tableName
* @param string $name
*
* @return Table
*
* @throws SchemaException
*/
public function getTable($tableName)
public function getTable($name)
{
$tableName = $this->getFullQualifiedAssetName($tableName);
if (! isset($this->_tables[$tableName])) {
throw SchemaException::tableDoesNotExist($tableName);
$name = $this->getFullQualifiedAssetName($name);
if (! isset($this->_tables[$name])) {
throw SchemaException::tableDoesNotExist($name);
}
return $this->_tables[$tableName];
return $this->_tables[$name];
}
/**
......@@ -216,29 +216,29 @@ class Schema extends AbstractAsset
/**
* Does this schema have a namespace with the given name?
*
* @param string $namespaceName
* @param string $name
*
* @return bool
*/
public function hasNamespace($namespaceName)
public function hasNamespace($name)
{
$namespaceName = strtolower($this->getUnquotedAssetName($namespaceName));
$name = strtolower($this->getUnquotedAssetName($name));
return isset($this->namespaces[$namespaceName]);
return isset($this->namespaces[$name]);
}
/**
* Does this schema have a table with the given name?
*
* @param string $tableName
* @param string $name
*
* @return bool
*/
public function hasTable($tableName)
public function hasTable($name)
{
$tableName = $this->getFullQualifiedAssetName($tableName);
$name = $this->getFullQualifiedAssetName($name);
return isset($this->_tables[$tableName]);
return isset($this->_tables[$name]);
}
/**
......@@ -291,21 +291,21 @@ class Schema extends AbstractAsset
/**
* Creates a new namespace.
*
* @param string $namespaceName The name of the namespace to create.
* @param string $name The name of the namespace to create.
*
* @return Schema This schema instance.
*
* @throws SchemaException
*/
public function createNamespace($namespaceName)
public function createNamespace($name)
{
$unquotedNamespaceName = strtolower($this->getUnquotedAssetName($namespaceName));
$unquotedName = strtolower($this->getUnquotedAssetName($name));
if (isset($this->namespaces[$unquotedNamespaceName])) {
throw SchemaException::namespaceAlreadyExists($unquotedNamespaceName);
if (isset($this->namespaces[$unquotedName])) {
throw SchemaException::namespaceAlreadyExists($unquotedName);
}
$this->namespaces[$unquotedNamespaceName] = $namespaceName;
$this->namespaces[$unquotedName] = $name;
return $this;
}
......@@ -313,17 +313,17 @@ class Schema extends AbstractAsset
/**
* Creates a new table.
*
* @param string $tableName
* @param string $name
*
* @return Table
*/
public function createTable($tableName)
public function createTable($name)
{
$table = new Table($tableName);
$table = new Table($name);
$this->_addTable($table);
foreach ($this->_schemaConfig->getDefaultTableOptions() as $name => $value) {
$table->addOption($name, $value);
foreach ($this->_schemaConfig->getDefaultTableOptions() as $option => $value) {
$table->addOption($option, $value);
}
return $table;
......@@ -332,17 +332,17 @@ class Schema extends AbstractAsset
/**
* Renames a table.
*
* @param string $oldTableName
* @param string $newTableName
* @param string $oldName
* @param string $newName
*
* @return Schema
*/
public function renameTable($oldTableName, $newTableName)
public function renameTable($oldName, $newName)
{
$table = $this->getTable($oldTableName);
$table->_setName($newTableName);
$table = $this->getTable($oldName);
$table->_setName($newName);
$this->dropTable($oldTableName);
$this->dropTable($oldName);
$this->_addTable($table);
return $this;
......@@ -351,15 +351,15 @@ class Schema extends AbstractAsset
/**
* Drops a table from the schema.
*
* @param string $tableName
* @param string $name
*
* @return Schema
*/
public function dropTable($tableName)
public function dropTable($name)
{
$tableName = $this->getFullQualifiedAssetName($tableName);
$this->getTable($tableName);
unset($this->_tables[$tableName]);
$name = $this->getFullQualifiedAssetName($name);
$this->getTable($name);
unset($this->_tables[$name]);
return $this;
}
......
......@@ -537,15 +537,15 @@ SQL
}
/**
* @param string $tableName
* @param string $name
*/
public function listTableDetails($tableName): Table
public function listTableDetails($name): Table
{
$table = parent::listTableDetails($tableName);
$table = parent::listTableDetails($name);
$tableCreateSql = $this->getCreateTableSQL($tableName) ?? '';
$tableCreateSql = $this->getCreateTableSQL($name) ?? '';
$comment = $this->parseTableCommentFromSQL($tableName, $tableCreateSql);
$comment = $this->parseTableCommentFromSQL($name, $tableCreateSql);
if ($comment !== null) {
$table->addOption('comment', $comment);
......
......@@ -44,7 +44,7 @@ class Table extends AbstractAsset
protected $_schemaConfig = null;
/**
* @param string $tableName
* @param string $name
* @param Column[] $columns
* @param Index[] $indexes
* @param ForeignKeyConstraint[] $fkConstraints
......@@ -53,13 +53,13 @@ class Table extends AbstractAsset
*
* @throws DBALException
*/
public function __construct($tableName, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = [])
public function __construct($name, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = [])
{
if (strlen($tableName) === 0) {
throw DBALException::invalidTableName($tableName);
if (strlen($name) === 0) {
throw DBALException::invalidTableName($name);
}
$this->_setName($tableName);
$this->_setName($name);
foreach ($columns as $column) {
$this->_addColumn($column);
......@@ -151,20 +151,20 @@ class Table extends AbstractAsset
/**
* Drops an index from this table.
*
* @param string $indexName The index name.
* @param string $name The index name.
*
* @return void
*
* @throws SchemaException If the index does not exist.
*/
public function dropIndex($indexName)
public function dropIndex($name)
{
$indexName = $this->normalizeIdentifier($indexName);
if (! $this->hasIndex($indexName)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name);
$name = $this->normalizeIdentifier($name);
if (! $this->hasIndex($name)) {
throw SchemaException::indexDoesNotExist($name, $this->_name);
}
unset($this->_indexes[$indexName]);
unset($this->_indexes[$name]);
}
/**
......@@ -190,8 +190,8 @@ class Table extends AbstractAsset
/**
* Renames an index.
*
* @param string $oldIndexName The name of the index to rename from.
* @param string|null $newIndexName The name of the index to rename to.
* @param string $oldName The name of the index to rename from.
* @param string|null $newName The name of the index to rename to.
* If null is given, the index name will be auto-generated.
*
* @return self This table instance.
......@@ -199,38 +199,38 @@ class Table extends AbstractAsset
* @throws SchemaException If no index exists for the given current name
* or if an index with the given new name already exists on this table.
*/
public function renameIndex($oldIndexName, $newIndexName = null)
public function renameIndex($oldName, $newName = null)
{
$oldIndexName = $this->normalizeIdentifier($oldIndexName);
$normalizedNewIndexName = $this->normalizeIdentifier($newIndexName);
$oldName = $this->normalizeIdentifier($oldName);
$normalizedNewName = $this->normalizeIdentifier($newName);
if ($oldIndexName === $normalizedNewIndexName) {
if ($oldName === $normalizedNewName) {
return $this;
}
if (! $this->hasIndex($oldIndexName)) {
throw SchemaException::indexDoesNotExist($oldIndexName, $this->_name);
if (! $this->hasIndex($oldName)) {
throw SchemaException::indexDoesNotExist($oldName, $this->_name);
}
if ($this->hasIndex($normalizedNewIndexName)) {
throw SchemaException::indexAlreadyExists($normalizedNewIndexName, $this->_name);
if ($this->hasIndex($normalizedNewName)) {
throw SchemaException::indexAlreadyExists($normalizedNewName, $this->_name);
}
$oldIndex = $this->_indexes[$oldIndexName];
$oldIndex = $this->_indexes[$oldName];
if ($oldIndex->isPrimary()) {
$this->dropPrimaryKey();
return $this->setPrimaryKey($oldIndex->getColumns(), $newIndexName ?? false);
return $this->setPrimaryKey($oldIndex->getColumns(), $newName ?? false);
}
unset($this->_indexes[$oldIndexName]);
unset($this->_indexes[$oldName]);
if ($oldIndex->isUnique()) {
return $this->addUniqueIndex($oldIndex->getColumns(), $newIndexName, $oldIndex->getOptions());
return $this->addUniqueIndex($oldIndex->getColumns(), $newName, $oldIndex->getOptions());
}
return $this->addIndex($oldIndex->getColumns(), $newIndexName, $oldIndex->getFlags(), $oldIndex->getOptions());
return $this->addIndex($oldIndex->getColumns(), $newName, $oldIndex->getFlags(), $oldIndex->getOptions());
}
/**
......@@ -279,15 +279,15 @@ class Table extends AbstractAsset
}
/**
* @param string $columnName
* @param string $name
* @param string $typeName
* @param mixed[] $options
*
* @return Column
*/
public function addColumn($columnName, $typeName, array $options = [])
public function addColumn($name, $typeName, array $options = [])
{
$column = new Column($columnName, Type::getType($typeName), $options);
$column = new Column($name, Type::getType($typeName), $options);
$this->_addColumn($column);
......@@ -299,14 +299,14 @@ class Table extends AbstractAsset
*
* @deprecated
*
* @param string $oldColumnName
* @param string $newColumnName
* @param string $oldName
* @param string $name
*
* @return void
*
* @throws DBALException
*/
public function renameColumn($oldColumnName, $newColumnName)
public function renameColumn($oldName, $name)
{
throw new DBALException('Table#renameColumn() was removed, because it drops and recreates ' .
'the column instead. There is no fix available, because a schema diff cannot reliably detect if a ' .
......@@ -316,14 +316,14 @@ class Table extends AbstractAsset
/**
* Change Column Details.
*
* @param string $columnName
* @param string $name
* @param mixed[] $options
*
* @return self
*/
public function changeColumn($columnName, array $options)
public function changeColumn($name, array $options)
{
$column = $this->getColumn($columnName);
$column = $this->getColumn($name);
$column->setOptions($options);
return $this;
......@@ -332,14 +332,14 @@ class Table extends AbstractAsset
/**
* Drops a Column from the Table.
*
* @param string $columnName
* @param string $name
*
* @return self
*/
public function dropColumn($columnName)
public function dropColumn($name)
{
$columnName = $this->normalizeIdentifier($columnName);
unset($this->_columns[$columnName]);
$name = $this->normalizeIdentifier($name);
unset($this->_columns[$name]);
return $this;
}
......@@ -541,53 +541,53 @@ class Table extends AbstractAsset
/**
* Returns whether this table has a foreign key constraint with the given name.
*
* @param string $constraintName
* @param string $name
*
* @return bool
*/
public function hasForeignKey($constraintName)
public function hasForeignKey($name)
{
$constraintName = $this->normalizeIdentifier($constraintName);
$name = $this->normalizeIdentifier($name);
return isset($this->_fkConstraints[$constraintName]);
return isset($this->_fkConstraints[$name]);
}
/**
* Returns the foreign key constraint with the given name.
*
* @param string $constraintName The constraint name.
* @param string $name The constraint name.
*
* @return ForeignKeyConstraint
*
* @throws SchemaException If the foreign key does not exist.
*/
public function getForeignKey($constraintName)
public function getForeignKey($name)
{
$constraintName = $this->normalizeIdentifier($constraintName);
if (! $this->hasForeignKey($constraintName)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
$name = $this->normalizeIdentifier($name);
if (! $this->hasForeignKey($name)) {
throw SchemaException::foreignKeyDoesNotExist($name, $this->_name);
}
return $this->_fkConstraints[$constraintName];
return $this->_fkConstraints[$name];
}
/**
* Removes the foreign key constraint with the given name.
*
* @param string $constraintName The constraint name.
* @param string $name The constraint name.
*
* @return void
*
* @throws SchemaException
*/
public function removeForeignKey($constraintName)
public function removeForeignKey($name)
{
$constraintName = $this->normalizeIdentifier($constraintName);
if (! $this->hasForeignKey($constraintName)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
$name = $this->normalizeIdentifier($name);
if (! $this->hasForeignKey($name)) {
throw SchemaException::foreignKeyDoesNotExist($name, $this->_name);
}
unset($this->_fkConstraints[$constraintName]);
unset($this->_fkConstraints[$name]);
}
/**
......@@ -639,34 +639,34 @@ class Table extends AbstractAsset
/**
* Returns whether this table has a Column with the given name.
*
* @param string $columnName The column name.
* @param string $name The column name.
*
* @return bool
*/
public function hasColumn($columnName)
public function hasColumn($name)
{
$columnName = $this->normalizeIdentifier($columnName);
$name = $this->normalizeIdentifier($name);
return isset($this->_columns[$columnName]);
return isset($this->_columns[$name]);
}
/**
* Returns the Column with the given name.
*
* @param string $columnName The column name.
* @param string $name The column name.
*
* @return Column
*
* @throws SchemaException If the column does not exist.
*/
public function getColumn($columnName)
public function getColumn($name)
{
$columnName = $this->normalizeIdentifier($columnName);
if (! $this->hasColumn($columnName)) {
throw SchemaException::columnDoesNotExist($columnName, $this->_name);
$name = $this->normalizeIdentifier($name);
if (! $this->hasColumn($name)) {
throw SchemaException::columnDoesNotExist($name, $this->_name);
}
return $this->_columns[$columnName];
return $this->_columns[$name];
}
/**
......@@ -714,34 +714,34 @@ class Table extends AbstractAsset
/**
* Returns whether this table has an Index with the given name.
*
* @param string $indexName The index name.
* @param string $name The index name.
*
* @return bool
*/
public function hasIndex($indexName)
public function hasIndex($name)
{
$indexName = $this->normalizeIdentifier($indexName);
$name = $this->normalizeIdentifier($name);
return isset($this->_indexes[$indexName]);
return isset($this->_indexes[$name]);
}
/**
* Returns the Index with the given name.
*
* @param string $indexName The index name.
* @param string $name The index name.
*
* @return Index
*
* @throws SchemaException If the index does not exist.
*/
public function getIndex($indexName)
public function getIndex($name)
{
$indexName = $this->normalizeIdentifier($indexName);
if (! $this->hasIndex($indexName)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name);
$name = $this->normalizeIdentifier($name);
if (! $this->hasIndex($name)) {
throw SchemaException::indexDoesNotExist($name, $this->_name);
}
return $this->_indexes[$indexName];
return $this->_indexes[$name];
}
/**
......
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