Commit 8dbf562d authored by Marco Pivetta's avatar Marco Pivetta

Merge pull request #642 from JeroenDeDauw/as

foreach AS -> foreach as
parents 3065aff5 a7a8f31a
...@@ -20,7 +20,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -20,7 +20,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('id', 'integer', array()); $table->addColumn('id', 'integer', array());
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -46,10 +46,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -46,10 +46,10 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
$this->setExpectedException('\Doctrine\DBAL\Exception\TableExistsException'); $this->setExpectedException('\Doctrine\DBAL\Exception\TableExistsException');
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
} }
...@@ -72,7 +72,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -72,7 +72,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$owningTable->setPrimaryKey(array('id')); $owningTable->setPrimaryKey(array('id'));
$owningTable->addForeignKeyConstraint($table, array('constraint_id'), array('id')); $owningTable->addForeignKeyConstraint($table, array('constraint_id'), array('id'));
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -92,7 +92,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -92,7 +92,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('value', 'integer', array('notnull' => true)); $table->addColumn('value', 'integer', array('notnull' => true));
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -107,7 +107,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -107,7 +107,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table = $schema->createTable("bad_fieldname_table"); $table = $schema->createTable("bad_fieldname_table");
$table->addColumn('id', 'integer', array()); $table->addColumn('id', 'integer', array());
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -125,7 +125,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -125,7 +125,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table2 = $schema->createTable("ambiguous_list_table_2"); $table2 = $schema->createTable("ambiguous_list_table_2");
$table2->addColumn('id', 'integer'); $table2->addColumn('id', 'integer');
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -142,7 +142,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -142,7 +142,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('id', 'integer'); $table->addColumn('id', 'integer');
$table->addUniqueIndex(array('id')); $table->addUniqueIndex(array('id'));
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -157,7 +157,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -157,7 +157,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('id', 'integer', array()); $table->addColumn('id', 'integer', array());
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -195,7 +195,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -195,7 +195,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('id', 'integer'); $table->addColumn('id', 'integer');
$this->setExpectedException($exceptionClass); $this->setExpectedException($exceptionClass);
foreach ($schema->toSql($conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->executeQuery($sql); $conn->executeQuery($sql);
} }
} }
...@@ -236,7 +236,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -236,7 +236,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->setExpectedException('Doctrine\DBAL\Exception\ConnectionException'); $this->setExpectedException('Doctrine\DBAL\Exception\ConnectionException');
foreach ($schema->toSql($conn->getDatabasePlatform()) AS $sql) { foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->executeQuery($sql); $conn->executeQuery($sql);
} }
} }
......
...@@ -116,7 +116,7 @@ class ModifyLimitQueryTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -116,7 +116,7 @@ class ModifyLimitQueryTest extends \Doctrine\Tests\DbalFunctionalTestCase
{ {
$p = $this->_conn->getDatabasePlatform(); $p = $this->_conn->getDatabasePlatform();
$data = array(); $data = array();
foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) AS $row) { foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) {
$row = array_change_key_case($row, CASE_LOWER); $row = array_change_key_case($row, CASE_LOWER);
$data[] = $row['test_int']; $data[] = $row['test_int'];
} }
......
...@@ -109,7 +109,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -109,7 +109,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function assertFetchResultRows($rows) public function assertFetchResultRows($rows)
{ {
$this->assertEquals(2, count($rows)); $this->assertEquals(2, count($rows));
foreach ($rows AS $row) { foreach ($rows as $row) {
$this->assertFetchResultRow($row); $this->assertFetchResultRow($row);
} }
} }
......
...@@ -31,7 +31,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -31,7 +31,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
} }
$this->_conn->executeUpdate('DELETE FROM caching'); $this->_conn->executeUpdate('DELETE FROM caching');
foreach ($this->expectedResult AS $row) { foreach ($this->expectedResult as $row) {
$this->_conn->insert('caching', $row); $this->_conn->insert('caching', $row);
} }
...@@ -50,7 +50,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -50,7 +50,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testFetchNum() public function testFetchNum()
{ {
$expectedResult = array(); $expectedResult = array();
foreach ($this->expectedResult AS $v) { foreach ($this->expectedResult as $v) {
$expectedResult[] = array_values($v); $expectedResult[] = array_values($v);
} }
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_NUM); $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_NUM);
...@@ -59,7 +59,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -59,7 +59,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testFetchBoth() public function testFetchBoth()
{ {
$expectedResult = array(); $expectedResult = array();
foreach ($this->expectedResult AS $v) { foreach ($this->expectedResult as $v) {
$expectedResult[] = array_merge($v, array_values($v)); $expectedResult[] = array_merge($v, array_values($v));
} }
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH); $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH);
...@@ -68,7 +68,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -68,7 +68,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testFetchColumn() public function testFetchColumn()
{ {
$expectedResult = array(); $expectedResult = array();
foreach ($this->expectedResult AS $v) { foreach ($this->expectedResult as $v) {
$expectedResult[] = array_shift($v); $expectedResult[] = array_shift($v);
} }
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN); $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN);
...@@ -77,7 +77,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -77,7 +77,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testMixingFetch() public function testMixingFetch()
{ {
$numExpectedResult = array(); $numExpectedResult = array();
foreach ($this->expectedResult AS $v) { foreach ($this->expectedResult as $v) {
$numExpectedResult[] = array_values($v); $numExpectedResult[] = array_values($v);
} }
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
......
...@@ -69,7 +69,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -69,7 +69,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertInternalType('array', $sequences, 'listSequences() should return an array.'); $this->assertInternalType('array', $sequences, 'listSequences() should return an array.');
$foundSequence = null; $foundSequence = null;
foreach($sequences AS $sequence) { foreach($sequences as $sequence) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.'); $this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.');
if(strtolower($sequence->getName()) == 'list_sequences_test_seq') { if(strtolower($sequence->getName()) == 'list_sequences_test_seq') {
$foundSequence = $sequence; $foundSequence = $sequence;
...@@ -104,7 +104,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -104,7 +104,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$this->assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'."); $this->assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'.");
$foundTable = false; $foundTable = false;
foreach ($tables AS $table) { foreach ($tables as $table) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table); $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table);
if (strtolower($table->getName()) == 'list_tables_test') { if (strtolower($table->getName()) == 'list_tables_test') {
$foundTable = true; $foundTable = true;
...@@ -722,7 +722,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -722,7 +722,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
protected function assertHasTable($tables, $tableName) protected function assertHasTable($tables, $tableName)
{ {
$foundTable = false; $foundTable = false;
foreach ($tables AS $table) { foreach ($tables as $table) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.'); $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.');
if (strtolower($table->getName()) == 'list_tables_test_new_name') { if (strtolower($table->getName()) == 'list_tables_test_new_name') {
$foundTable = true; $foundTable = true;
......
...@@ -50,7 +50,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -50,7 +50,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn("id", "integer"); $table->addColumn("id", "integer");
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($platform->getCreateTableSQL($table) AS $sql) { foreach ($platform->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
...@@ -87,7 +87,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -87,7 +87,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn("id", "integer"); $table->addColumn("id", "integer");
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($platform->getCreateTableSQL($table) AS $sql) { foreach ($platform->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
......
...@@ -36,7 +36,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -36,7 +36,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
try { try {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
} catch(\Exception $e) { } catch(\Exception $e) {
......
...@@ -18,7 +18,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -18,7 +18,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('test_string', 'string', array('notnull' => false)); $table->addColumn('test_string', 'string', array('notnull' => false));
$table->setPrimaryKey(array('id')); $table->setPrimaryKey(array('id'));
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql); $this->_conn->executeQuery($sql);
} }
} catch(\Exception $e) { } catch(\Exception $e) {
......
...@@ -55,7 +55,7 @@ class MySQLSchemaTest extends \PHPUnit_Framework_TestCase ...@@ -55,7 +55,7 @@ class MySQLSchemaTest extends \PHPUnit_Framework_TestCase
$tableOld->addUnnamedForeignKeyConstraint('test_foreign', array('foo_id'), array('foo_id')); $tableOld->addUnnamedForeignKeyConstraint('test_foreign', array('foo_id'), array('foo_id'));
$sqls = array(); $sqls = array();
foreach ($tableOld->getForeignKeys() AS $fk) { foreach ($tableOld->getForeignKeys() as $fk) {
$sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld); $sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld);
} }
......
...@@ -49,7 +49,7 @@ class DbalFunctionalTestCase extends DbalTestCase ...@@ -49,7 +49,7 @@ class DbalFunctionalTestCase extends DbalTestCase
if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) { if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) {
$queries = ""; $queries = "";
$i = count($this->_sqlLoggerStack->queries); $i = count($this->_sqlLoggerStack->queries);
foreach (array_reverse($this->_sqlLoggerStack->queries) AS $query) { foreach (array_reverse($this->_sqlLoggerStack->queries) as $query) {
$params = array_map(function($p) { if (is_object($p)) return get_class($p); else return "'".$p."'"; }, $query['params'] ?: array()); $params = array_map(function($p) { if (is_object($p)) return get_class($p); else return "'".$p."'"; }, $query['params'] ?: array());
$queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL; $queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL;
$i--; $i--;
...@@ -57,7 +57,7 @@ class DbalFunctionalTestCase extends DbalTestCase ...@@ -57,7 +57,7 @@ class DbalFunctionalTestCase extends DbalTestCase
$trace = $e->getTrace(); $trace = $e->getTrace();
$traceMsg = ""; $traceMsg = "";
foreach($trace AS $part) { foreach($trace as $part) {
if(isset($part['file'])) { if(isset($part['file'])) {
if(strpos($part['file'], "PHPUnit/") !== false) { if(strpos($part['file'], "PHPUnit/") !== false) {
// Beginning with PHPUnit files we don't print the trace anymore. // Beginning with PHPUnit files we don't print the trace anymore.
......
...@@ -60,7 +60,7 @@ class TestUtil ...@@ -60,7 +60,7 @@ class TestUtil
$schema = $sm->createSchema(); $schema = $sm->createSchema();
$stmts = $schema->toDropSql($realConn->getDatabasePlatform()); $stmts = $schema->toDropSql($realConn->getDatabasePlatform());
foreach ($stmts AS $stmt) { foreach ($stmts as $stmt) {
$realConn->exec($stmt); $realConn->exec($stmt);
} }
} }
...@@ -80,7 +80,7 @@ class TestUtil ...@@ -80,7 +80,7 @@ class TestUtil
if (isset($GLOBALS['db_event_subscribers'])) { if (isset($GLOBALS['db_event_subscribers'])) {
$evm = $conn->getEventManager(); $evm = $conn->getEventManager();
foreach (explode(",", $GLOBALS['db_event_subscribers']) AS $subscriberClass) { foreach (explode(",", $GLOBALS['db_event_subscribers']) as $subscriberClass) {
$subscriberInstance = new $subscriberClass(); $subscriberInstance = new $subscriberClass();
$evm->addEventSubscriber($subscriberInstance); $evm->addEventSubscriber($subscriberInstance);
} }
......
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