Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead code cleanup #91

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Connection.php
Expand Up @@ -1110,7 +1110,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
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
Expand Up @@ -59,7 +59,7 @@ public function connect(array $params, $username = null, $password = null, array
$driverOptions
);

foreach ($this->_userDefinedFunctions AS $fn => $data) {
foreach ($this->_userDefinedFunctions as $fn => $data) {
$pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
Expand Up @@ -64,7 +64,7 @@ public function postConnect(ConnectionEventArgs $args)
if (count($this->_defaultSessionVars)) {
array_change_key_case($this->_defaultSessionVars, \CASE_UPPER);
$vars = array();
foreach ($this->_defaultSessionVars AS $option => $value) {
foreach ($this->_defaultSessionVars as $option => $value) {
$vars[] = $option." = '".$value."'";
}
$sql = "ALTER SESSION SET ".implode(" ", $vars);
Expand Down
28 changes: 14 additions & 14 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Expand Up @@ -1024,7 +1024,7 @@ public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXE
$options['primary'] = array();

if (($createFlags&self::CREATE_INDEXES) > 0) {
foreach ($table->getIndexes() AS $index) {
foreach ($table->getIndexes() as $index) {
/* @var $index Index */
if ($index->isPrimary()) {
$options['primary'] = $index->getColumns();
Expand All @@ -1036,7 +1036,7 @@ public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXE

$columnSql = array();
$columns = array();
foreach ($table->getColumns() AS $column) {
foreach ($table->getColumns() as $column) {
/* @var \Doctrine\DBAL\Schema\Column $column */

if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn)) {
Expand Down Expand Up @@ -1078,7 +1078,7 @@ public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXE

if (($createFlags&self::CREATE_FOREIGNKEYS) > 0) {
$options['foreignKeys'] = array();
foreach ($table->getForeignKeys() AS $fkConstraint) {
foreach ($table->getForeignKeys() as $fkConstraint) {
$options['foreignKeys'][] = $fkConstraint;
}
}
Expand All @@ -1094,7 +1094,7 @@ public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXE

$sql = $this->_getCreateTableSQL($tableName, $columns, $options);
if ($this->supportsCommentOnStatement()) {
foreach ($table->getColumns() AS $column) {
foreach ($table->getColumns() as $column) {
if ($this->getColumnComment($column)) {
$sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column));
}
Expand Down Expand Up @@ -1146,7 +1146,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$sql[] = $query;

if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] AS $definition) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
}
}
Expand Down Expand Up @@ -1217,7 +1217,7 @@ public function getCreateConstraintSQL(\Doctrine\DBAL\Schema\Constraint $constra
$query .= ' FOREIGN KEY';

$foreignColumns = array();
foreach ($constraint->getForeignColumns() AS $column) {
foreach ($constraint->getForeignColumns() as $column) {
$foreignColumns[] = $column;
}

Expand Down Expand Up @@ -1460,18 +1460,18 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)

$sql = array();
if ($this->supportsForeignKeyConstraints()) {
foreach ($diff->removedForeignKeys AS $foreignKey) {
foreach ($diff->removedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
}
foreach ($diff->changedForeignKeys AS $foreignKey) {
foreach ($diff->changedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
}
}

foreach ($diff->removedIndexes AS $index) {
foreach ($diff->removedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName);
}
foreach ($diff->changedIndexes AS $index) {
foreach ($diff->changedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName);
}

Expand All @@ -1488,18 +1488,18 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff)

$sql = array();
if ($this->supportsForeignKeyConstraints()) {
foreach ($diff->addedForeignKeys AS $foreignKey) {
foreach ($diff->addedForeignKeys as $foreignKey) {
$sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
}
foreach ($diff->changedForeignKeys AS $foreignKey) {
foreach ($diff->changedForeignKeys as $foreignKey) {
$sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
}
}

foreach ($diff->addedIndexes AS $index) {
foreach ($diff->addedIndexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
foreach ($diff->changedIndexes AS $index) {
foreach ($diff->changedIndexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/DBAL/Platforms/DB2Platform.php
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,23 +376,23 @@ 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;
}

$queryParts[] = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}

foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}

$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
}

foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
Expand All @@ -403,7 +403,7 @@ public function getAlterTableSQL(TableDiff $diff)
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}

foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
Expand Down
Expand Up @@ -61,7 +61,7 @@ private function isReservedWord($word)
}

$keywordLists = array();
foreach ($this->keywordLists AS $keywordList) {
foreach ($this->keywordLists as $keywordList) {
if ($keywordList->isKeyword($word)) {
$keywordLists[] = $keywordList->getName();
}
Expand Down
13 changes: 6 additions & 7 deletions lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
Expand Up @@ -154,7 +154,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 @@ -210,13 +209,13 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$sql[] = $query;

if (isset($options['indexes']) && !empty($options['indexes'])) {
foreach ($options['indexes'] AS $index) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
}

if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] AS $definition) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
}
}
Expand Down Expand Up @@ -284,23 +283,23 @@ 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;
}

$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}

foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}

$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
}

foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
Expand All @@ -311,7 +310,7 @@ public function getAlterTableSQL(TableDiff $diff)
$this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}

foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
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 All @@ -470,15 +470,15 @@ public function getAlterTableSQL(TableDiff $diff)
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}

foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}

$queryParts[] = 'DROP ' . $column->getQuotedName($this);
}

foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
Expand All @@ -491,7 +491,7 @@ public function getAlterTableSQL(TableDiff $diff)
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}

foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
Expand Down
15 changes: 5 additions & 10 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
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,11 +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);

$sql[] = 'DECLARE
Expand Down Expand Up @@ -573,7 +568,7 @@ public function getAlterTableSQL(TableDiff $diff)
$columnSql = array();

$fields = array();
foreach ($diff->addedColumns AS $column) {
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
Expand All @@ -588,7 +583,7 @@ public function getAlterTableSQL(TableDiff $diff)
}

$fields = array();
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
Expand All @@ -603,7 +598,7 @@ public function getAlterTableSQL(TableDiff $diff)
$sql[] = 'ALTER TABLE ' . $diff->name . ' MODIFY (' . implode(', ', $fields) . ')';
}

foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
Expand All @@ -612,7 +607,7 @@ public function getAlterTableSQL(TableDiff $diff)
}

$fields = array();
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Expand Up @@ -403,7 +403,7 @@ public function getAlterTableSQL(TableDiff $diff)
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
}

foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$sql[] = $query;

if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] AS $index) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Portability/Statement.php
Expand Up @@ -138,7 +138,7 @@ public function fetchAll($fetchStyle = PDO::FETCH_BOTH, $columnIndex = 0)
return $rows;
}

foreach ($rows AS $num => $row) {
foreach ($rows as $num => $row) {
$rows[$num] = $this->fixRow($row, $iterateRow, $fixCase);
}

Expand All @@ -156,7 +156,7 @@ protected function fixRow($row, $iterateRow, $fixCase)
}

if ($iterateRow) {
foreach ($row AS $k => $v) {
foreach ($row as $k => $v) {
if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $v === '') {
$row[$k] = null;
} else if (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Query/QueryBuilder.php
Expand Up @@ -374,7 +374,7 @@ public function add($sqlPartName, $sqlPart, $append = false)

if ($append) {
if ($sqlPartName == "orderBy" || $sqlPartName == "groupBy" || $sqlPartName == "select" || $sqlPartName == "set") {
foreach ($sqlPart AS $part) {
foreach ($sqlPart as $part) {
$this->sqlParts[$sqlPartName][] = $part;
}
} else if ($isArray && is_array($sqlPart[key($sqlPart)])) {
Expand Down