From b5e15999e8f626b9a50edef142fffc7be57d0211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 23 Aug 2020 21:12:56 +0200 Subject: [PATCH] Use consistent parameter names --- composer.json | 2 +- composer.lock | 2 +- lib/Doctrine/DBAL/Connection.php | 4 +-- lib/Doctrine/DBAL/Driver/Connection.php | 4 +-- .../DBAL/Driver/IBMDB2/DB2Connection.php | 8 ++--- .../DBAL/Driver/Mysqli/MysqliConnection.php | 4 +-- .../SQLAnywhere/SQLAnywhereConnection.php | 8 ++--- .../DBAL/Platforms/AbstractPlatform.php | 30 +++++++++---------- lib/Doctrine/DBAL/Platforms/DB2Platform.php | 16 +++++----- .../DBAL/Platforms/DrizzlePlatform.php | 6 ++-- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 6 ++-- .../DBAL/Platforms/OraclePlatform.php | 16 +++++----- .../DBAL/Platforms/PostgreSqlPlatform.php | 14 ++++----- .../DBAL/Platforms/SQLAnywherePlatform.php | 18 +++++------ .../DBAL/Platforms/SQLServerPlatform.php | 30 +++++++++---------- .../DBAL/Platforms/SqlitePlatform.php | 10 +++---- lib/Doctrine/DBAL/Portability/Statement.php | 4 +-- .../DBAL/Schema/AbstractSchemaManager.php | 6 ++-- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 6 ++-- .../DBAL/Schema/SQLAnywhereSchemaManager.php | 6 ++-- .../DBAL/Schema/SQLServerSchemaManager.php | 6 ++-- 21 files changed, 103 insertions(+), 103 deletions(-) diff --git a/composer.json b/composer.json index 6cf85a3a2d6..9d04f559217 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "phpunit/phpunit": "^8.5.5", "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "^3.11.4" + "vimeo/psalm": "^3.14.2" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." diff --git a/composer.lock b/composer.lock index a1bf8e2af03..d364e0a6cb5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8fe7de32ab1cec3ff8b2908b5b9e8de4", + "content-hash": "c7a5a6e253d55b762c8113554a570902", "packages": [ { "name": "doctrine/cache", diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index c19a1d8a08a..a233fd10847 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -823,11 +823,11 @@ public function quoteIdentifier($str) /** * {@inheritDoc} */ - public function quote($input, $type = ParameterType::STRING) + public function quote($value, $type = ParameterType::STRING) { $connection = $this->getWrappedConnection(); - [$value, $bindingType] = $this->getBindingInfo($input, $type); + [$value, $bindingType] = $this->getBindingInfo($value, $type); return $connection->quote($value, $bindingType); } diff --git a/lib/Doctrine/DBAL/Driver/Connection.php b/lib/Doctrine/DBAL/Driver/Connection.php index ea66c97effb..cb4444dccd4 100644 --- a/lib/Doctrine/DBAL/Driver/Connection.php +++ b/lib/Doctrine/DBAL/Driver/Connection.php @@ -31,12 +31,12 @@ public function query(); /** * Quotes a string for use in a query. * - * @param mixed $input + * @param mixed $value * @param int $type * * @return mixed */ - public function quote($input, $type = ParameterType::STRING); + public function quote($value, $type = ParameterType::STRING); /** * Executes an SQL statement and return the number of affected rows. diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php index 4d54f120b92..a866d939b8f 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php @@ -106,15 +106,15 @@ public function query() /** * {@inheritdoc} */ - public function quote($input, $type = ParameterType::STRING) + public function quote($value, $type = ParameterType::STRING) { - $input = db2_escape_string($input); + $value = db2_escape_string($value); if ($type === ParameterType::INTEGER) { - return $input; + return $value; } - return "'" . $input . "'"; + return "'" . $value . "'"; } /** diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php index 00f1333bdbd..d5b61bc01f1 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php @@ -153,9 +153,9 @@ public function query() /** * {@inheritdoc} */ - public function quote($input, $type = ParameterType::STRING) + public function quote($value, $type = ParameterType::STRING) { - return "'" . $this->conn->escape_string($input) . "'"; + return "'" . $this->conn->escape_string($value) . "'"; } /** diff --git a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php index 3a2e0b58996..cd464b01c62 100644 --- a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php +++ b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php @@ -165,13 +165,13 @@ public function query() /** * {@inheritdoc} */ - public function quote($input, $type = ParameterType::STRING) + public function quote($value, $type = ParameterType::STRING) { - if (is_int($input) || is_float($input)) { - return $input; + if (is_int($value) || is_float($value)) { + return $value; } - return "'" . sasql_escape_string($this->connection, $input) . "'"; + return "'" . sasql_escape_string($this->connection, $value) . "'"; } /** diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index f07e42b0cb7..91475d460f9 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -909,19 +909,19 @@ public function getNowExpression() * * SQLite only supports the 2 parameter variant of this function. * - * @param string $value An sql string literal or column name/alias. - * @param int $from Where to start the substring portion. + * @param string $string An sql string literal or column name/alias. + * @param int $start Where to start the substring portion. * @param int|null $length The substring portion length. * * @return string */ - public function getSubstringExpression($value, $from, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length === null) { - return 'SUBSTRING(' . $value . ' FROM ' . $from . ')'; + return 'SUBSTRING(' . $string . ' FROM ' . $start . ')'; } - return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')'; + return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')'; } /** @@ -1696,19 +1696,19 @@ public function getInlineColumnCommentSQL($comment) /** * Returns the SQL used to create a table. * - * @param string $tableName + * @param string $name * @param mixed[][] $columns * @param mixed[] $options * * @return string[] */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { - foreach ($options['uniqueConstraints'] as $name => $definition) { - $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); + foreach ($options['uniqueConstraints'] as $index => $definition) { + $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition); } } @@ -1722,7 +1722,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options } } - $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql; + $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; $check = $this->getCheckDeclarationSQL($columns); if (! empty($check)) { @@ -1735,7 +1735,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options if (isset($options['foreignKeys'])) { foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); + $sql[] = $this->getCreateForeignKeySQL($definition, $name); } } @@ -3516,14 +3516,14 @@ public function getMaxIdentifierLength() /** * Returns the insert SQL for an empty insert statement. * - * @param string $tableName - * @param string $identifierColumnName + * @param string $quotedTableName + * @param string $quotedIdentifierColumnName * * @return string */ - public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName) + public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) { - return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (null)'; + return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (null)'; } /** diff --git a/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/lib/Doctrine/DBAL/Platforms/DB2Platform.php index 9b9a0622b62..877273bc64d 100644 --- a/lib/Doctrine/DBAL/Platforms/DB2Platform.php +++ b/lib/Doctrine/DBAL/Platforms/DB2Platform.php @@ -487,7 +487,7 @@ public function getIndexDeclarationSQL($name, Index $index) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $indexes = []; if (isset($options['indexes'])) { @@ -496,10 +496,10 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options $options['indexes'] = []; - $sqls = parent::_getCreateTableSQL($tableName, $columns, $options); + $sqls = parent::_getCreateTableSQL($name, $columns, $options); foreach ($indexes as $definition) { - $sqls[] = $this->getCreateIndexSQL($definition, $tableName); + $sqls[] = $this->getCreateIndexSQL($definition, $name); } return $sqls; @@ -772,9 +772,9 @@ public function getDefaultValueDeclarationSQL($column) /** * {@inheritDoc} */ - public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName) + public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) { - return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)'; + return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)'; } /** @@ -835,13 +835,13 @@ public function getLocateExpression($str, $substr, $startPos = false) /** * {@inheritDoc} */ - public function getSubstringExpression($value, $from, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length === null) { - return 'SUBSTR(' . $value . ', ' . $from . ')'; + return 'SUBSTR(' . $string . ', ' . $start . ')'; } - return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')'; + return 'SUBSTR(' . $string . ', ' . $start . ', ' . $length . ')'; } /** diff --git a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php index 770ad0bdcb9..199a14a232c 100644 --- a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php @@ -187,7 +187,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -216,7 +216,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options $query .= 'TEMPORARY '; } - $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') '; + $query .= 'TABLE ' . $name . ' (' . $queryFields . ') '; $query .= $this->buildTableOptions($options); $query .= $this->buildPartitionOptions($options); @@ -224,7 +224,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options if (isset($options['foreignKeys'])) { foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); + $sql[] = $this->getCreateForeignKeySQL($definition, $name); } } diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index f963f377dcf..8d338c8405e 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -416,7 +416,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -445,7 +445,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options $query .= 'TEMPORARY '; } - $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') '; + $query .= 'TABLE ' . $name . ' (' . $queryFields . ') '; $query .= $this->buildTableOptions($options); $query .= $this->buildPartitionOptions($options); @@ -459,7 +459,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options // Propagate foreign key constraints only for InnoDB. if (isset($options['foreignKeys']) && $engine === 'INNODB') { foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); + $sql[] = $this->getCreateForeignKeySQL($definition, $name); } } diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index 18bca7d4316..2a0ceb9e90a 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -52,13 +52,13 @@ public static function assertValidIdentifier($identifier) /** * {@inheritDoc} */ - public function getSubstringExpression($value, $position, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length !== null) { - return sprintf('SUBSTR(%s, %d, %d)', $value, $position, $length); + return sprintf('SUBSTR(%s, %d, %d)', $string, $start, $length); } - return sprintf('SUBSTR(%s, %d)', $value, $position); + return sprintf('SUBSTR(%s, %d)', $string, $start); } /** @@ -384,13 +384,13 @@ public function getListSequencesSQL($database) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($table, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $indexes = $options['indexes'] ?? []; $options['indexes'] = []; - $sql = parent::_getCreateTableSQL($table, $columns, $options); + $sql = parent::_getCreateTableSQL($name, $columns, $options); - foreach ($columns as $name => $column) { + foreach ($columns as $columnName => $column) { if (isset($column['sequence'])) { $sql[] = $this->getCreateSequenceSQL($column['sequence']); } @@ -402,12 +402,12 @@ protected function _getCreateTableSQL($table, array $columns, array $options = [ continue; } - $sql = array_merge($sql, $this->getCreateAutoincrementSql($name, $table)); + $sql = array_merge($sql, $this->getCreateAutoincrementSql($columnName, $name)); } if (isset($indexes) && ! empty($indexes)) { foreach ($indexes as $index) { - $sql[] = $this->getCreateIndexSQL($index, $table); + $sql[] = $this->getCreateIndexSQL($index, $name); } } diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index 186ce86e7ba..0473d14867e 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -81,13 +81,13 @@ public function setUseBooleanTrueFalseStrings($flag) /** * {@inheritDoc} */ - public function getSubstringExpression($value, $from, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length === null) { - return 'SUBSTRING(' . $value . ' FROM ' . $from . ')'; + return 'SUBSTRING(' . $string . ' FROM ' . $start . ')'; } - return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')'; + return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')'; } /** @@ -789,7 +789,7 @@ public function getDropForeignKeySQL($foreignKey, $table) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -798,19 +798,19 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; } - $query = 'CREATE TABLE ' . $tableName . ' (' . $queryFields . ')'; + $query = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')'; $sql = [$query]; if (isset($options['indexes']) && ! empty($options['indexes'])) { foreach ($options['indexes'] as $index) { - $sql[] = $this->getCreateIndexSQL($index, $tableName); + $sql[] = $this->getCreateIndexSQL($index, $name); } } if (isset($options['foreignKeys'])) { foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); + $sql[] = $this->getCreateForeignKeySQL($definition, $name); } } diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index 782492a8626..ee6b2865b05 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -1088,13 +1088,13 @@ public function getStopDatabaseSQL($database) /** * {@inheritdoc} */ - public function getSubstringExpression($value, $from, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length === null) { - return 'SUBSTRING(' . $value . ', ' . $from . ')'; + return 'SUBSTRING(' . $string . ', ' . $start . ')'; } - return 'SUBSTRING(' . $value . ', ' . $from . ', ' . $length . ')'; + return 'SUBSTRING(' . $string . ', ' . $start . ', ' . $length . ')'; } /** @@ -1124,10 +1124,10 @@ public function getTimeTypeDeclarationSQL(array $column) /** * {@inheritdoc} */ - public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false) + public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) { if (! $char) { - switch ($pos) { + switch ($mode) { case TrimMode::LEADING: return $this->getLtrimExpression($str); @@ -1141,7 +1141,7 @@ public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = fa $pattern = "'%[^' + " . $char . " + ']%'"; - switch ($pos) { + switch ($mode) { case TrimMode::LEADING: return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))'; @@ -1248,7 +1248,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column) /** * {@inheritdoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); $indexSql = []; @@ -1262,7 +1262,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options if (! empty($options['indexes'])) { foreach ((array) $options['indexes'] as $index) { assert($index instanceof Index); - $indexSql[] = $this->getCreateIndexSQL($index, $tableName); + $indexSql[] = $this->getCreateIndexSQL($index, $name); } } @@ -1283,7 +1283,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options } } - $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql; + $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; $check = $this->getCheckDeclarationSQL($columns); if (! empty($check)) { diff --git a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index 753f3afbe66..30a815dc668 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -245,14 +245,14 @@ public function getDropIndexSQL($index, $table = null) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function _getCreateTableSQL($name, array $columns, array $options = []) { $defaultConstraintsSql = []; $commentsSql = []; $tableComment = $options['comment'] ?? null; if ($tableComment !== null) { - $commentsSql[] = $this->getCommentOnTableSQL($tableName, $tableComment); + $commentsSql[] = $this->getCommentOnTableSQL($name, $tableComment); } // @todo does other code breaks because of this? @@ -264,15 +264,15 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options // Build default constraints SQL statements. if (isset($column['default'])) { - $defaultConstraintsSql[] = 'ALTER TABLE ' . $tableName . - ' ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $column); + $defaultConstraintsSql[] = 'ALTER TABLE ' . $name . + ' ADD' . $this->getDefaultConstraintDeclarationSQL($name, $column); } if (empty($column['comment']) && ! is_numeric($column['comment'])) { continue; } - $commentsSql[] = $this->getCreateColumnCommentSQL($tableName, $column['name'], $column['comment']); + $commentsSql[] = $this->getCreateColumnCommentSQL($name, $column['name'], $column['comment']); } $columnListSql = $this->getColumnDeclarationListSQL($columns); @@ -293,7 +293,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options . ' (' . implode(', ', array_unique(array_values($options['primary']))) . ')'; } - $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql; + $query = 'CREATE TABLE ' . $name . ' (' . $columnListSql; $check = $this->getCheckDeclarationSQL($columns); if (! empty($check)) { @@ -306,13 +306,13 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options if (isset($options['indexes']) && ! empty($options['indexes'])) { foreach ($options['indexes'] as $index) { - $sql[] = $this->getCreateIndexSQL($index, $tableName); + $sql[] = $this->getCreateIndexSQL($index, $name); } } if (isset($options['foreignKeys'])) { foreach ((array) $options['foreignKeys'] as $definition) { - $sql[] = $this->getCreateForeignKeySQL($definition, $tableName); + $sql[] = $this->getCreateForeignKeySQL($definition, $name); } } @@ -1068,10 +1068,10 @@ public function getModExpression($expression1, $expression2) /** * {@inheritDoc} */ - public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false) + public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) { if (! $char) { - switch ($pos) { + switch ($mode) { case TrimMode::LEADING: $trimFn = 'LTRIM'; break; @@ -1089,11 +1089,11 @@ public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = fa $pattern = "'%[^' + " . $char . " + ']%'"; - if ($pos === TrimMode::LEADING) { + if ($mode === TrimMode::LEADING) { return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)'; } - if ($pos === TrimMode::TRAILING) { + if ($mode === TrimMode::TRAILING) { return 'reverse(stuff(reverse(' . $str . '), 1, ' . 'patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))'; } @@ -1132,13 +1132,13 @@ public function getListNamespacesSQL() /** * {@inheritDoc} */ - public function getSubstringExpression($value, $from, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length !== null) { - return 'SUBSTRING(' . $value . ', ' . $from . ', ' . $length . ')'; + return 'SUBSTRING(' . $string . ', ' . $start . ', ' . $length . ')'; } - return 'SUBSTRING(' . $value . ', ' . $from . ', LEN(' . $value . ') - ' . $from . ' + 1)'; + return 'SUBSTRING(' . $string . ', ' . $start . ', LEN(' . $string . ') - ' . $start . ' + 1)'; } /** diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index 9af06a3b507..1f3a099ac95 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -78,11 +78,11 @@ public function getNowExpression($type = 'timestamp') /** * {@inheritDoc} */ - public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false) + public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false) { $trimChar = $char !== false ? ', ' . $char : ''; - switch ($pos) { + switch ($mode) { case TrimMode::LEADING: $trimFn = 'LTRIM'; break; @@ -103,13 +103,13 @@ public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = fa * * SQLite only supports the 2 parameter variant of this function */ - public function getSubstringExpression($value, $position, $length = null) + public function getSubstringExpression($string, $start, $length = null) { if ($length !== null) { - return 'SUBSTR(' . $value . ', ' . $position . ', ' . $length . ')'; + return 'SUBSTR(' . $string . ', ' . $start . ', ' . $length . ')'; } - return 'SUBSTR(' . $value . ', ' . $position . ', LENGTH(' . $value . '))'; + return 'SUBSTR(' . $string . ', ' . $start . ', LENGTH(' . $string . '))'; } /** diff --git a/lib/Doctrine/DBAL/Portability/Statement.php b/lib/Doctrine/DBAL/Portability/Statement.php index 9e39bbf7a21..fe2fb0bd0ce 100644 --- a/lib/Doctrine/DBAL/Portability/Statement.php +++ b/lib/Doctrine/DBAL/Portability/Statement.php @@ -113,11 +113,11 @@ public function execute($params = null) /** * {@inheritdoc} */ - public function setFetchMode($fetchMode, $arg1 = null, $arg2 = null) + public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) { $this->defaultFetchMode = $fetchMode; - return $this->stmt->setFetchMode($fetchMode, $arg1, $arg2); + return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3); } /** diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 18c2dcb9ef5..352ce58f3e1 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -838,15 +838,15 @@ abstract protected function _getPortableTableColumnDefinition($tableColumn); /** * Aggregates and groups the index results according to the required data result. * - * @param mixed[][] $tableIndexRows + * @param mixed[][] $tableIndexes * @param string|null $tableName * * @return Index[] */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { $result = []; - foreach ($tableIndexRows as $tableIndex) { + foreach ($tableIndexes as $tableIndex) { $indexName = $keyName = $tableIndex['key_name']; if ($tableIndex['primary']) { $keyName = 'primary'; diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index bb106f01657..d270b585685 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -129,14 +129,14 @@ protected function _getPortableTablesList($tables) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { - foreach ($tableIndexRows as &$tableIndexRow) { + foreach ($tableIndexes as &$tableIndexRow) { $tableIndexRow = array_change_key_case($tableIndexRow, CASE_LOWER); $tableIndexRow['primary'] = (bool) $tableIndexRow['primary']; } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::_getPortableTableIndexesList($tableIndexes, $tableName); } /** diff --git a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php index 3f83b93e9e4..c909c7e58ad 100644 --- a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php @@ -201,9 +201,9 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { - foreach ($tableIndexRows as &$tableIndex) { + foreach ($tableIndexes as &$tableIndex) { $tableIndex['primary'] = (bool) $tableIndex['primary']; $tableIndex['flags'] = []; @@ -222,7 +222,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName = nu $tableIndex['flags'][] = 'for_olap_workload'; } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::_getPortableTableIndexesList($tableIndexes, $tableName); } /** diff --git a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php index a62f07739e5..cd2b9d2f96c 100644 --- a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php @@ -181,15 +181,15 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { - foreach ($tableIndexRows as &$tableIndex) { + foreach ($tableIndexes as &$tableIndex) { $tableIndex['non_unique'] = (bool) $tableIndex['non_unique']; $tableIndex['primary'] = (bool) $tableIndex['primary']; $tableIndex['flags'] = $tableIndex['flags'] ? [$tableIndex['flags']] : null; } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::_getPortableTableIndexesList($tableIndexes, $tableName); } /**