Skip to content

Commit

Permalink
Fix CS: Apply unused local variable changes by @hhamon - Fixes GH-91
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 24, 2012
1 parent 8c9e9e8 commit a8019c6
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ private function _bindTypedValues($stmt, array $params, array $types)
// Positional parameters
$typeOffset = array_key_exists(0, $types) ? -1 : 0;
$bindIndex = 1;
foreach ($params as $position => $value) {
foreach ($params as $value) {
$typeIndex = $bindIndex + $typeOffset;
if (isset($types[$typeIndex])) {
$type = $types[$typeIndex];
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options

$sqls = parent::_getCreateTableSQL($tableName, $columns, $options);

foreach ($indexes as $index => $definition) {
foreach ($indexes as $definition) {
$sqls[] = $this->getCreateIndexSQL($definition, $tableName);
}
return $sqls;
Expand All @@ -376,7 +376,7 @@ public function getAlterTableSQL(TableDiff $diff)
$columnSql = array();

$queryParts = array();
foreach ($diff->addedColumns as $fieldName => $column) {
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public function getAlterTableSQL(TableDiff $diff)
$queryParts[] = 'RENAME TO ' . $diff->newName;
}

foreach ($diff->addedColumns as $fieldName => $column) {
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
Expand Down
6 changes: 1 addition & 5 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ protected function _getCreateTableSQL($table, array $columns, array $options = a
}

if (isset($indexes) && ! empty($indexes)) {
foreach ($indexes as $indexName => $index) {
foreach ($indexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $table);
}
}
Expand Down Expand Up @@ -408,10 +408,6 @@ public function getCreateAutoincrementSql($name, $table, $start = 1)
$sql = array();

$indexName = $table . '_AI_PK';
$definition = array(
'primary' => true,
'columns' => array($name => true),
);

$idx = new \Doctrine\DBAL\Schema\Index($indexName, array($name), true, true);

Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public function getDropForeignKeySQL($foreignKey, $table)
public function getDropIndexSQL($index, $table=null)
{
if ($index instanceof \Doctrine\DBAL\Schema\Index) {
$index_ = $index;
$index = $index->getQuotedName($this);
} else if (!is_string($index)) {
throw new \InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
Expand Down Expand Up @@ -322,7 +321,7 @@ public function getAlterTableSQL(TableDiff $diff)
$queryParts[] = 'RENAME TO ' . $diff->newName;
}

foreach ($diff->addedColumns as $fieldName => $column) {
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
Expand Down
18 changes: 9 additions & 9 deletions lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public function renameTable($name, $newName)
protected function _getPortableDatabasesList($databases)
{
$list = array();
foreach ($databases as $key => $value) {
foreach ($databases as $value) {
if ($value = $this->_getPortableDatabaseDefinition($value)) {
$list[] = $value;
}
Expand All @@ -592,7 +592,7 @@ protected function _getPortableDatabaseDefinition($database)
protected function _getPortableFunctionsList($functions)
{
$list = array();
foreach ($functions as $key => $value) {
foreach ($functions as $value) {
if ($value = $this->_getPortableFunctionDefinition($value)) {
$list[] = $value;
}
Expand All @@ -608,7 +608,7 @@ protected function _getPortableFunctionDefinition($function)
protected function _getPortableTriggersList($triggers)
{
$list = array();
foreach ($triggers as $key => $value) {
foreach ($triggers as $value) {
if ($value = $this->_getPortableTriggerDefinition($value)) {
$list[] = $value;
}
Expand All @@ -624,7 +624,7 @@ protected function _getPortableTriggerDefinition($trigger)
protected function _getPortableSequencesList($sequences)
{
$list = array();
foreach ($sequences as $key => $value) {
foreach ($sequences as $value) {
if ($value = $this->_getPortableSequenceDefinition($value)) {
$list[] = $value;
}
Expand Down Expand Up @@ -656,7 +656,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns)
$eventManager = $this->_platform->getEventManager();

$list = array();
foreach ($tableColumns as $key => $tableColumn) {
foreach ($tableColumns as $tableColumn) {
$column = null;
$defaultPrevented = false;

Expand Down Expand Up @@ -748,7 +748,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null
protected function _getPortableTablesList($tables)
{
$list = array();
foreach ($tables as $key => $value) {
foreach ($tables as $value) {
if ($value = $this->_getPortableTableDefinition($value)) {
$list[] = $value;
}
Expand All @@ -764,7 +764,7 @@ protected function _getPortableTableDefinition($table)
protected function _getPortableUsersList($users)
{
$list = array();
foreach ($users as $key => $value) {
foreach ($users as $value) {
if ($value = $this->_getPortableUserDefinition($value)) {
$list[] = $value;
}
Expand All @@ -780,7 +780,7 @@ protected function _getPortableUserDefinition($user)
protected function _getPortableViewsList($views)
{
$list = array();
foreach ($views as $key => $value) {
foreach ($views as $value) {
if ($view = $this->_getPortableViewDefinition($value)) {
$viewName = strtolower($view->getQuotedName($this->_platform));
$list[$viewName] = $view;
Expand All @@ -797,7 +797,7 @@ protected function _getPortableViewDefinition($view)
protected function _getPortableTableForeignKeysList($tableForeignKeys)
{
$list = array();
foreach ($tableForeignKeys as $key => $value) {
foreach ($tableForeignKeys as $value) {
if ($value = $this->_getPortableTableForeignKeyDefinition($value)) {
$list[] = $value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences)
}
}

foreach ($renameCandidates as $candidate => $candidateColumns) {
foreach ($renameCandidates as $candidateColumns) {
if (count($candidateColumns) == 1) {
list($removedColumn, $addedColumn) = $candidateColumns[0];
$removedColumnName = strtolower($removedColumn->getName());
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null)
{
$eventManager = $this->_platform->getEventManager();

$tableIndexRows = array();
$indexes = array();
foreach($tableIndexes as $indexKey => $data) {
$data = array_change_key_case($data, \CASE_LOWER);
Expand Down
10 changes: 2 additions & 8 deletions lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,11 @@ protected function _getPortableTableColumnDefinition($tableColumn)
}

$length = ((int) $length == 0) ? null : (int) $length;
$def = array(
'type' => $type,
'length' => $length,
'unsigned' => (bool) $unsigned,
'fixed' => (bool) $fixed
);

$options = array(
'length' => $length,
'unsigned' => (bool)$unsigned,
'fixed' => (bool)$fixed,
'unsigned' => (bool) $unsigned,
'fixed' => (bool) $fixed,
'default' => isset($tableColumn['default']) ? $tableColumn['default'] : null,
'notnull' => (bool) ($tableColumn['null'] != 'YES'),
'scale' => null,
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected function _getPortableTableColumnDefinition($tableColumn)
protected function _getPortableTableForeignKeysList($tableForeignKeys)
{
$list = array();
foreach ($tableForeignKeys as $key => $value) {
foreach ($tableForeignKeys as $value) {
$value = \array_change_key_case($value, CASE_LOWER);
if (!isset($list[$value['constraint_name']])) {
if ($value['delete_rule'] == "NO ACTION") {
Expand Down

0 comments on commit a8019c6

Please sign in to comment.