Commit 32108355 authored by Steve Müller's avatar Steve Müller

fix CS

parent 1d5afda9
......@@ -105,11 +105,11 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
if ($fetchMode === PDO::FETCH_ASSOC) {
return $row;
} else if ($fetchMode === PDO::FETCH_NUM) {
} elseif ($fetchMode === PDO::FETCH_NUM) {
return array_values($row);
} else if ($fetchMode === PDO::FETCH_BOTH) {
} elseif ($fetchMode === PDO::FETCH_BOTH) {
return array_merge($row, array_values($row));
} else if ($fetchMode === PDO::FETCH_COLUMN) {
} elseif ($fetchMode === PDO::FETCH_COLUMN) {
return reset($row);
} else {
throw new \InvalidArgumentException("Invalid fetch-style given for fetching result.");
......
......@@ -161,11 +161,11 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
if ($fetchMode == PDO::FETCH_ASSOC) {
return $row;
} else if ($fetchMode == PDO::FETCH_NUM) {
} elseif ($fetchMode == PDO::FETCH_NUM) {
return array_values($row);
} else if ($fetchMode == PDO::FETCH_BOTH) {
} elseif ($fetchMode == PDO::FETCH_BOTH) {
return array_merge($row, array_values($row));
} else if ($fetchMode == PDO::FETCH_COLUMN) {
} elseif ($fetchMode == PDO::FETCH_COLUMN) {
return reset($row);
} else {
throw new \InvalidArgumentException("Invalid fetch-style given for caching result.");
......
......@@ -224,7 +224,7 @@ class Connection implements DriverConnection
if ( ! isset($params['platform'])) {
$this->_platform = $driver->getDatabasePlatform();
} else if ($params['platform'] instanceof Platforms\AbstractPlatform) {
} elseif ($params['platform'] instanceof Platforms\AbstractPlatform) {
$this->_platform = $params['platform'];
} else {
throw DBALException::invalidPlatformSpecified();
......@@ -793,7 +793,7 @@ class Connection implements DriverConnection
// is the real key part of this row pointers map or is the cache only pointing to other cache keys?
if (isset($data[$realKey])) {
$stmt = new ArrayStatement($data[$realKey]);
} else if (array_key_exists($realKey, $data)) {
} elseif (array_key_exists($realKey, $data)) {
$stmt = new ArrayStatement(array());
}
}
......@@ -1101,7 +1101,7 @@ class Connection implements DriverConnection
if ($logger) {
$logger->stopQuery();
}
} else if ($this->_nestTransactionsWithSavepoints) {
} elseif ($this->_nestTransactionsWithSavepoints) {
if ($logger) {
$logger->startQuery('"SAVEPOINT"');
}
......@@ -1141,7 +1141,7 @@ class Connection implements DriverConnection
if ($logger) {
$logger->stopQuery();
}
} else if ($this->_nestTransactionsWithSavepoints) {
} elseif ($this->_nestTransactionsWithSavepoints) {
if ($logger) {
$logger->startQuery('"RELEASE SAVEPOINT"');
}
......@@ -1208,7 +1208,7 @@ class Connection implements DriverConnection
if (false === $this->autoCommit) {
$this->beginTransaction();
}
} else if ($this->_nestTransactionsWithSavepoints) {
} elseif ($this->_nestTransactionsWithSavepoints) {
if ($logger) {
$logger->startQuery('"ROLLBACK TO SAVEPOINT"');
}
......
......@@ -109,10 +109,10 @@ class MasterSlaveConnection extends Connection
*/
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
{
if ( !isset($params['slaves']) || !isset($params['master']) ) {
if ( !isset($params['slaves']) || !isset($params['master'])) {
throw new \InvalidArgumentException('master or slaves configuration missing');
}
if ( count($params['slaves']) == 0 ) {
if (count($params['slaves']) == 0) {
throw new \InvalidArgumentException('You have to configure at least one slaves.');
}
......@@ -144,7 +144,7 @@ class MasterSlaveConnection extends Connection
$requestedConnectionChange = ($connectionName !== null);
$connectionName = $connectionName ?: 'slave';
if ( $connectionName !== 'slave' && $connectionName !== 'master' ) {
if ($connectionName !== 'slave' && $connectionName !== 'master') {
throw new \InvalidArgumentException("Invalid option to connect(), only master or slave allowed.");
}
......
......@@ -133,7 +133,7 @@ class DBALException extends \Exception
*/
private static function formatParameters(array $params)
{
return '[' . implode(', ', array_map(function($param) {
return '[' . implode(', ', array_map(function ($param) {
$json = @json_encode($param);
if (! is_string($json) || $json == 'null' && is_string($param)) {
......
......@@ -19,8 +19,10 @@
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Platforms\DrizzlePlatform;
use Doctrine\DBAL\Schema\DrizzleSchemaManager;
/**
* Drizzle driver using PDO MySql.
......@@ -74,7 +76,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\DrizzlePlatform();
return new DrizzlePlatform();
}
/**
......@@ -82,7 +84,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{
return new \Doctrine\DBAL\Schema\DrizzleSchemaManager($conn);
return new DrizzleSchemaManager($conn);
}
/**
......
......@@ -19,7 +19,9 @@
namespace Doctrine\DBAL\Driver\IBMDB2;
class DB2Connection implements \Doctrine\DBAL\Driver\Connection
use Doctrine\DBAL\Driver\Connection;
class DB2Connection implements Connection
{
/**
* @var resource
......@@ -78,7 +80,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
public function quote($input, $type=\PDO::PARAM_STR)
{
$input = db2_escape_string($input);
if ($type == \PDO::PARAM_INT ) {
if ($type == \PDO::PARAM_INT) {
return $input;
} else {
return "'".$input."'";
......
......@@ -21,6 +21,8 @@ namespace Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;
/**
* IBM DB2 Driver.
......@@ -63,7 +65,7 @@ class DB2Driver implements Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\DB2Platform;
return new DB2Platform();
}
/**
......@@ -71,7 +73,7 @@ class DB2Driver implements Driver
*/
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
return new DB2SchemaManager($conn);
}
/**
......@@ -85,7 +87,7 @@ class DB2Driver implements Driver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,7 +19,7 @@
namespace Doctrine\DBAL\Driver\IBMDB2;
use \Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Driver\Statement;
class DB2Statement implements \IteratorAggregate, Statement
{
......
......@@ -19,9 +19,11 @@
namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Platforms\MySqlPlatform;
/**
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
......@@ -51,7 +53,7 @@ class Driver implements DriverInterface, ExceptionConverterDriver
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn);
}
......@@ -61,13 +63,13 @@ class Driver implements DriverInterface, ExceptionConverterDriver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\MySqlPlatform();
return new MySqlPlatform();
}
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -20,7 +20,7 @@
namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Driver\Connection as Connection;
use \Doctrine\DBAL\Driver\PingableConnection;
use Doctrine\DBAL\Driver\PingableConnection;
/**
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
......
......@@ -19,7 +19,9 @@
namespace Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\OracleSchemaManager;
/**
* A Doctrine DBAL driver for the Oracle OCI8 PHP extensions.
......@@ -88,15 +90,15 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\OraclePlatform();
return new Platforms\OraclePlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
return new OracleSchemaManager($conn);
}
/**
......@@ -110,7 +112,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,6 +19,7 @@
namespace Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Platforms\OraclePlatform;
/**
......@@ -26,7 +27,7 @@ use Doctrine\DBAL\Platforms\OraclePlatform;
*
* @since 2.0
*/
class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
class OCI8Connection implements Connection
{
/**
* @var resource
......
......@@ -121,7 +121,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
$i += $len-1; // jump ahead
$stmtLen = strlen($statement); // adjust statement length
++$count;
} else if ($statement[$i] == "'" || $statement[$i] == '"') {
} elseif ($statement[$i] == "'" || $statement[$i] == '"') {
$inLiteral = ! $inLiteral; // switch state!
}
}
......@@ -149,7 +149,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
$lob->writeTemporary($variable, OCI_TEMP_BLOB);
return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);
} else if ($length !== null) {
} elseif ($length !== null) {
return oci_bind_by_name($this->_sth, $column, $variable, $length);
}
......
......@@ -20,6 +20,9 @@
namespace Doctrine\DBAL\Driver\PDOIbm;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;
/**
* Driver for the PDO IBM extension.
......@@ -38,7 +41,7 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
$conn = new \Doctrine\DBAL\Driver\PDOConnection(
$conn = new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
......@@ -77,7 +80,7 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\DB2Platform;
return new DB2Platform();
}
/**
......@@ -85,7 +88,7 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
return new DB2SchemaManager($conn);
}
/**
......@@ -99,7 +102,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -22,6 +22,9 @@ namespace Doctrine\DBAL\Driver\PDOMySql;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
use PDOException;
/**
......@@ -37,7 +40,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
try {
$conn = new \Doctrine\DBAL\Driver\PDOConnection(
$conn = new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
......@@ -84,15 +87,15 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\MySqlPlatform();
return new MySqlPlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn);
return new MySqlSchemaManager($conn);
}
/**
......@@ -106,7 +109,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,7 +19,10 @@
namespace Doctrine\DBAL\Driver\PDOOracle;
use Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Schema\OracleSchemaManager;
/**
* PDO Oracle driver.
......@@ -36,7 +39,7 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new \Doctrine\DBAL\Driver\PDOConnection(
return new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
......@@ -93,15 +96,15 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\OraclePlatform();
return new OraclePlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
return new OracleSchemaManager($conn);
}
/**
......@@ -115,7 +118,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,8 +19,11 @@
namespace Doctrine\DBAL\Driver\PDOPgSql;
use Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use PDOException;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
......@@ -37,7 +40,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
try {
return new \Doctrine\DBAL\Driver\PDOConnection(
return new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
......@@ -87,15 +90,15 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\PostgreSqlPlatform();
return new PostgreSqlPlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\PostgreSqlSchemaManager($conn);
return new PostgreSqlSchemaManager($conn);
}
/**
......@@ -109,7 +112,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,8 +19,12 @@
namespace Doctrine\DBAL\Driver\PDOSqlite;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
use PDOException;
/**
......@@ -51,7 +55,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
}
try {
$pdo = new \Doctrine\DBAL\Driver\PDOConnection(
$pdo = new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
......@@ -80,7 +84,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
$dsn = 'sqlite:';
if (isset($params['path'])) {
$dsn .= $params['path'];
} else if (isset($params['memory'])) {
} elseif (isset($params['memory'])) {
$dsn .= ':memory:';
}
......@@ -92,15 +96,15 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\SqlitePlatform();
return new SqlitePlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\SqliteSchemaManager($conn);
return new SqliteSchemaManager($conn);
}
/**
......@@ -114,7 +118,7 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
......
......@@ -19,12 +19,14 @@
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver\PDOConnection;
/**
* Sqlsrv Connection implementation.
*
* @since 2.0
*/
class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrine\DBAL\Driver\Connection
class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection
{
/**
* @override
......@@ -33,11 +35,11 @@ class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrin
{
$val = parent::quote($value, $type);
// Fix for a driver version terminating all values with null byte
if (strpos($val, "\0") !== false) {
$val = substr($val, 0, -1);
}
// Fix for a driver version terminating all values with null byte
if (strpos($val, "\0") !== false) {
$val = substr($val, 0, -1);
}
return $val;
return $val;
}
}
......@@ -19,6 +19,9 @@
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
/**
* The PDO-based Sqlsrv driver.
*
......@@ -74,7 +77,7 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\SQLServer2008Platform();
return new SQLServer2008Platform();
}
/**
* {@inheritdoc}
......@@ -82,7 +85,7 @@ class Driver implements \Doctrine\DBAL\Driver
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{
return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
return new SQLServerSchemaManager($conn);
}
/**
......
......@@ -36,4 +36,4 @@ interface PingableConnection
* @return bool
*/
public function ping();
}
\ No newline at end of file
}
......@@ -92,4 +92,3 @@ class SQLAnywhereException extends DBALException
return new self('SQL Anywhere error occurred but no error message was retrieved from driver.', $code);
}
}
......@@ -19,6 +19,10 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
/**
* Driver for ext/sqlsrv.
*/
......@@ -56,15 +60,15 @@ class Driver implements \Doctrine\DBAL\Driver
*/
public function getDatabasePlatform()
{
return new \Doctrine\DBAL\Platforms\SQLServer2008Platform();
return new SQLServer2008Platform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
public function getSchemaManager(Connection $conn)
{
return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
return new SQLServerSchemaManager($conn);
}
/**
......@@ -78,7 +82,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* {@inheritdoc}
*/
public function getDatabase(\Doctrine\DBAL\Connection $conn)
public function getDatabase(Connection $conn)
{
$params = $conn->getParams();
return $params['dbname'];
......
......@@ -19,13 +19,15 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\Connection;
/**
* SQL Server implementation for the Connection interface.
*
* @since 2.3
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class SQLSrvConnection implements \Doctrine\DBAL\Driver\Connection
class SQLSrvConnection implements Connection
{
/**
* @var resource
......@@ -81,7 +83,7 @@ class SQLSrvConnection implements \Doctrine\DBAL\Driver\Connection
{
if (is_int($value)) {
return $value;
} else if (is_float($value)) {
} elseif (is_float($value)) {
return sprintf('%F', $value);
}
......
......@@ -19,7 +19,9 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
class SQLSrvException extends \Doctrine\DBAL\DBALException
use Doctrine\DBAL\DBALException;
class SQLSrvException extends DBALException
{
/**
* Helper method to turn sql server errors into exception.
......
......@@ -191,7 +191,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
if ($this->lastInsertId) {
sqlsrv_next_result($this->stmt);
sqlsrv_fetch($this->stmt);
$this->lastInsertId->setId( sqlsrv_get_field($this->stmt, 0) );
$this->lastInsertId->setId(sqlsrv_get_field($this->stmt, 0));
}
}
......@@ -224,7 +224,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
if (isset(self::$fetchMap[$fetchMode])) {
return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]);
} else if ($fetchMode == PDO::FETCH_OBJ || $fetchMode == PDO::FETCH_CLASS) {
} elseif ($fetchMode == PDO::FETCH_OBJ || $fetchMode == PDO::FETCH_CLASS) {
$className = null;
$ctorArgs = null;
if (count($args) >= 2) {
......
......@@ -129,7 +129,7 @@ final class DriverManager
// check for existing pdo object
if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
throw DBALException::invalidPdoInstance();
} else if (isset($params['pdo'])) {
} elseif (isset($params['pdo'])) {
$params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME);
} else {
......
......@@ -36,11 +36,11 @@ class EchoSQLLogger implements SQLLogger
*/
public function startQuery($sql, array $params = null, array $types = null)
{
echo $sql . PHP_EOL;
echo $sql . PHP_EOL;
if ($params) {
var_dump($params);
}
}
if ($types) {
var_dump($types);
......
......@@ -1099,7 +1099,7 @@ abstract class AbstractPlatform
if ($table instanceof Table) {
$table = $table->getQuotedName($this);
} else if(!is_string($table)) {
} elseif (!is_string($table)) {
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......@@ -1141,7 +1141,7 @@ abstract class AbstractPlatform
{
if ($index instanceof Index) {
$index = $index->getQuotedName($this);
} else if(!is_string($index)) {
} elseif (!is_string($index)) {
throw new \InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
}
......@@ -1327,7 +1327,7 @@ abstract class AbstractPlatform
}
if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach($options['indexes'] as $index => $definition) {
foreach ($options['indexes'] as $index => $definition) {
$columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
}
}
......@@ -1409,7 +1409,7 @@ abstract class AbstractPlatform
$referencesClause = '';
if ($constraint instanceof Index) {
if($constraint->isPrimary()) {
if ($constraint->isPrimary()) {
$query .= ' PRIMARY KEY';
} elseif ($constraint->isUnique()) {
$query .= ' UNIQUE';
......@@ -1418,7 +1418,7 @@ abstract class AbstractPlatform
'Can only create primary or unique constraints, no common indexes with getCreateConstraintSQL().'
);
}
} else if ($constraint instanceof ForeignKeyConstraint) {
} elseif ($constraint instanceof ForeignKeyConstraint) {
$query .= ' FOREIGN KEY';
$referencesClause = ' REFERENCES ' . $constraint->getQuotedForeignTableName($this) .
......@@ -1921,13 +1921,13 @@ abstract class AbstractPlatform
if (isset($field['type'])) {
if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) {
$default = " DEFAULT ".$field['default'];
} else if ((string)$field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
} elseif ((string)$field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
$default = " DEFAULT ".$this->getCurrentTimestampSQL();
} else if ((string)$field['type'] == 'Time' && $field['default'] == $this->getCurrentTimeSQL()) {
} elseif ((string)$field['type'] == 'Time' && $field['default'] == $this->getCurrentTimeSQL()) {
$default = " DEFAULT ".$this->getCurrentTimeSQL();
} else if ((string)$field['type'] == 'Date' && $field['default'] == $this->getCurrentDateSQL()) {
} elseif ((string)$field['type'] == 'Date' && $field['default'] == $this->getCurrentDateSQL()) {
$default = " DEFAULT ".$this->getCurrentDateSQL();
} else if ((string) $field['type'] == 'Boolean') {
} elseif ((string) $field['type'] == 'Boolean') {
$default = " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
}
}
......@@ -2257,7 +2257,7 @@ abstract class AbstractPlatform
$item[$k] = (int) $value;
}
}
} else if (is_bool($item)) {
} elseif (is_bool($item)) {
$item = (int) $item;
}
......
......@@ -78,7 +78,7 @@ class DrizzlePlatform extends AbstractPlatform
*/
public function getDateSubHourExpression($date, $hours)
{
return 'DATE_SUB(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
return 'DATE_SUB(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
}
/**
......@@ -330,7 +330,7 @@ class DrizzlePlatform extends AbstractPlatform
{
if ($index instanceof Index) {
$indexName = $index->getQuotedName($this);
} else if (is_string($index)) {
} elseif (is_string($index)) {
$indexName = $index;
} else {
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
......@@ -338,7 +338,7 @@ class DrizzlePlatform extends AbstractPlatform
if ($table instanceof Table) {
$table = $table->getQuotedName($this);
} else if(!is_string($table)) {
} elseif (!is_string($table)) {
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......@@ -465,7 +465,7 @@ class DrizzlePlatform extends AbstractPlatform
{
if ($table instanceof Table) {
$table = $table->getQuotedName($this);
} else if(!is_string($table)) {
} elseif (!is_string($table)) {
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......@@ -483,7 +483,7 @@ class DrizzlePlatform extends AbstractPlatform
$item[$key] = ($value) ? 'true' : 'false';
}
}
} else if (is_bool($item) || is_numeric($item)) {
} elseif (is_bool($item) || is_numeric($item)) {
$item = ($item) ? 'true' : 'false';
}
......
......@@ -22,7 +22,7 @@ namespace Doctrine\DBAL\Platforms\Keywords;
/**
* Drizzle Keywordlist.
*
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
*/
class DrizzleKeywords extends KeywordList
{
......
......@@ -417,7 +417,7 @@ class MySqlPlatform extends AbstractPlatform
// add all indexes
if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach($options['indexes'] as $index => $definition) {
foreach ($options['indexes'] as $index => $definition) {
$queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
}
}
......@@ -656,7 +656,7 @@ class MySqlPlatform extends AbstractPlatform
$type = '';
if ($index->isUnique()) {
$type .= 'UNIQUE ';
} else if ($index->hasFlag('fulltext')) {
} elseif ($index->hasFlag('fulltext')) {
$type .= 'FULLTEXT ';
}
......@@ -721,7 +721,7 @@ class MySqlPlatform extends AbstractPlatform
{
if ($index instanceof Index) {
$indexName = $index->getQuotedName($this);
} else if(is_string($index)) {
} elseif (is_string($index)) {
$indexName = $index;
} else {
throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
......@@ -729,7 +729,7 @@ class MySqlPlatform extends AbstractPlatform
if ($table instanceof Table) {
$table = $table->getQuotedName($this);
} else if(!is_string($table)) {
} elseif (!is_string($table)) {
throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......@@ -841,7 +841,7 @@ class MySqlPlatform extends AbstractPlatform
{
if ($table instanceof Table) {
$table = $table->getQuotedName($this);
} else if(!is_string($table)) {
} elseif (!is_string($table)) {
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......
......@@ -544,7 +544,7 @@ LEFT JOIN user_cons_columns r_cols
$colCommentsTableName = "user_col_comments";
$ownerCondition = '';
if (null !== $database){
if (null !== $database) {
$database = strtoupper($database);
$tabColumnsTableName = "all_tab_columns";
$colCommentsTableName = "all_col_comments";
......
......@@ -113,7 +113,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
public function getDateSubHourExpression($date, $hours)
{
return "(" . $date ." - (" . $hours . " || ' hour')::interval)";
return "(" . $date ." - (" . $hours . " || ' hour')::interval)";
}
/**
......
......@@ -52,7 +52,7 @@ class SQLServer2008Platform extends SQLServer2005Platform
{
return 'TIME(0)';
}
/**
* {@inheritDoc}
*/
......
......@@ -211,7 +211,7 @@ class SQLServerPlatform extends AbstractPlatform
{
if ($index instanceof Index) {
$index = $index->getQuotedName($this);
} else if (!is_string($index)) {
} elseif (!is_string($index)) {
throw new \InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
}
......@@ -401,7 +401,7 @@ class SQLServerPlatform extends AbstractPlatform
if ($index->hasFlag('clustered')) {
$type .= 'CLUSTERED ';
} else if ($index->hasFlag('nonclustered')) {
} elseif ($index->hasFlag('nonclustered')) {
$type .= 'NONCLUSTERED ';
}
......@@ -832,8 +832,8 @@ class SQLServerPlatform extends AbstractPlatform
{
return "SELECT idx.name AS key_name,
col.name AS column_name,
~idx.is_unique AS non_unique,
idx.is_primary_key AS [primary],
~idx.is_unique AS non_unique,
idx.is_primary_key AS [primary],
CASE idx.type
WHEN '1' THEN 'clustered'
WHEN '2' THEN 'nonclustered'
......@@ -1168,7 +1168,7 @@ class SQLServerPlatform extends AbstractPlatform
$item[$key] = ($value) ? 1 : 0;
}
}
} else if (is_bool($item) || is_numeric($item)) {
} elseif (is_bool($item) || is_numeric($item)) {
$item = ($item) ? 1 : 0;
}
......
......@@ -1025,4 +1025,3 @@ class SqlitePlatform extends AbstractPlatform
return $primaryIndex;
}
}
......@@ -67,17 +67,17 @@ class Connection extends \Doctrine\DBAL\Connection
if (isset($params['portability'])) {
if ($this->_platform->getName() === "oracle") {
$params['portability'] = $params['portability'] & self::PORTABILITY_ORACLE;
} else if ($this->_platform->getName() === "postgresql") {
} elseif ($this->_platform->getName() === "postgresql") {
$params['portability'] = $params['portability'] & self::PORTABILITY_POSTGRESQL;
} else if ($this->_platform->getName() === "sqlite") {
} elseif ($this->_platform->getName() === "sqlite") {
$params['portability'] = $params['portability'] & self::PORTABILITY_SQLITE;
} else if ($this->_platform->getName() === "drizzle") {
} elseif ($this->_platform->getName() === "drizzle") {
$params['portability'] = self::PORTABILITY_DRIZZLE;
} else if ($this->_platform->getName() === 'sqlanywhere') {
} elseif ($this->_platform->getName() === 'sqlanywhere') {
$params['portability'] = self::PORTABILITY_SQLANYWHERE;
} elseif ($this->_platform->getName() === 'db2') {
$params['portability'] = self::PORTABILITY_DB2;
} else if ($this->_platform->getName() === 'mssql') {
} elseif ($this->_platform->getName() === 'mssql') {
$params['portability'] = $params['portability'] & self::PORTABILITY_SQLSRV;
} else {
$params['portability'] = $params['portability'] & self::PORTABILITY_OTHERVENDORS;
......
......@@ -203,7 +203,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
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)) {
} elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) {
$row[$k] = rtrim($v);
}
}
......@@ -222,7 +222,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
if ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM)) {
if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $value === '') {
$value = null;
} else if (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($value)) {
} elseif (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($value)) {
$value = rtrim($value);
}
}
......
......@@ -258,7 +258,7 @@ class ExpressionBuilder
{
return $this->comparison($x, 'LIKE', $y);
}
/**
* Creates a NOT LIKE() comparison expression with the given arguments.
*
......
......@@ -408,10 +408,10 @@ class QueryBuilder
foreach ($sqlPart as $part) {
$this->sqlParts[$sqlPartName][] = $part;
}
} else if ($isArray && is_array($sqlPart[key($sqlPart)])) {
} elseif ($isArray && is_array($sqlPart[key($sqlPart)])) {
$key = key($sqlPart);
$this->sqlParts[$sqlPartName][$key][] = $sqlPart[$key];
} else if ($isMultiple) {
} elseif ($isMultiple) {
$this->sqlParts[$sqlPartName][] = $sqlPart;
} else {
$this->sqlParts[$sqlPartName] = $sqlPart;
......@@ -753,7 +753,7 @@ class QueryBuilder
*/
public function where($predicates)
{
if ( ! (func_num_args() == 1 && $predicates instanceof CompositeExpression) ) {
if ( ! (func_num_args() == 1 && $predicates instanceof CompositeExpression)) {
$predicates = new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args());
}
......@@ -1100,7 +1100,7 @@ class QueryBuilder
}
foreach ($this->sqlParts['join'] as $fromAlias => $joins) {
if ( ! isset($knownAliases[$fromAlias]) ) {
if ( ! isset($knownAliases[$fromAlias])) {
throw QueryException::unknownAlias($fromAlias, array_keys($knownAliases));
}
}
......@@ -1196,9 +1196,9 @@ class QueryBuilder
*
* @return string the placeholder name used.
*/
public function createNamedParameter( $value, $type = \PDO::PARAM_STR, $placeHolder = null )
public function createNamedParameter($value, $type = \PDO::PARAM_STR, $placeHolder = null)
{
if ( $placeHolder === null ) {
if ($placeHolder === null) {
$this->boundCounter++;
$placeHolder = ":dcValue" . $this->boundCounter;
}
......@@ -1274,13 +1274,13 @@ class QueryBuilder
$this->sqlParts[$part][$idx] = clone $element;
}
}
} else if (is_object($elements)) {
} elseif (is_object($elements)) {
$this->sqlParts[$part] = clone $elements;
}
}
foreach ($this->params as $name => $param) {
if(is_object($param)){
if (is_object($param)) {
$this->params[$name] = clone $param;
}
}
......
......@@ -217,7 +217,7 @@ abstract class AbstractAsset
*/
protected function _generateIdentifierName($columnNames, $prefix='', $maxSize=30)
{
$hash = implode("", array_map(function($column) {
$hash = implode("", array_map(function ($column) {
return dechex(crc32($column));
}, $columnNames));
......
......@@ -345,7 +345,7 @@ abstract class AbstractSchemaManager
*/
public function dropIndex($index, $table)
{
if($index instanceof Index) {
if ($index instanceof Index) {
$index = $index->getQuotedName($this->_platform);
}
......@@ -805,14 +805,14 @@ abstract class AbstractSchemaManager
protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null)
{
$result = array();
foreach($tableIndexRows as $tableIndex) {
foreach ($tableIndexRows as $tableIndex) {
$indexName = $keyName = $tableIndex['key_name'];
if($tableIndex['primary']) {
if ($tableIndex['primary']) {
$keyName = 'primary';
}
$keyName = strtolower($keyName);
if(!isset($result[$keyName])) {
if (!isset($result[$keyName])) {
$result[$keyName] = array(
'name' => $indexName,
'columns' => array($tableIndex['column_name']),
......@@ -828,7 +828,7 @@ abstract class AbstractSchemaManager
$eventManager = $this->_platform->getEventManager();
$indexes = array();
foreach($result as $indexKey => $data) {
foreach ($result as $indexKey => $data) {
$index = null;
$defaultPrevented = false;
......@@ -980,7 +980,7 @@ abstract class AbstractSchemaManager
public function createSchema()
{
$sequences = array();
if($this->_platform->supportsSequences()) {
if ($this->_platform->supportsSequences()) {
$sequences = $this->listSequences();
}
$tables = $this->listTables();
......
......@@ -145,7 +145,7 @@ class Column extends AbstractAsset
*/
public function setLength($length)
{
if($length !== null) {
if ($length !== null) {
$this->_length = (int)$length;
} else {
$this->_length = null;
......
......@@ -60,7 +60,7 @@ class Comparator
$foreignKeysToTable = array();
foreach ( $toSchema->getTables() as $table ) {
foreach ($toSchema->getTables() as $table) {
$tableName = $table->getShortestName($toSchema->getName());
if ( ! $fromSchema->hasTable($tableName)) {
$diff->newTables[$tableName] = $toSchema->getTable($tableName);
......@@ -77,7 +77,7 @@ class Comparator
$tableName = $table->getShortestName($fromSchema->getName());
$table = $fromSchema->getTable($tableName);
if ( ! $toSchema->hasTable($tableName) ) {
if ( ! $toSchema->hasTable($tableName)) {
$diff->removedTables[$tableName] = $table;
}
......@@ -162,11 +162,11 @@ class Comparator
*/
public function diffSequence(Sequence $sequence1, Sequence $sequence2)
{
if($sequence1->getAllocationSize() != $sequence2->getAllocationSize()) {
if ($sequence1->getAllocationSize() != $sequence2->getAllocationSize()) {
return true;
}
if($sequence1->getInitialValue() != $sequence2->getInitialValue()) {
if ($sequence1->getInitialValue() != $sequence2->getInitialValue()) {
return true;
}
......@@ -192,9 +192,9 @@ class Comparator
$table1Columns = $table1->getColumns();
$table2Columns = $table2->getColumns();
// See if all the fields in table 1 exist in table 2.
/* See if all the fields in table 1 exist in table 2 */
foreach ($table2Columns as $columnName => $column) {
if ( ! $table1->hasColumn($columnName)) {
if ( !$table1->hasColumn($columnName)) {
$tableDifferences->addedColumns[$columnName] = $column;
$changes++;
}
......@@ -255,7 +255,7 @@ class Comparator
foreach ($fromFkeys as $key1 => $constraint1) {
foreach ($toFkeys as $key2 => $constraint2) {
if($this->diffForeignKey($constraint1, $constraint2) === false) {
if ($this->diffForeignKey($constraint1, $constraint2) === false) {
unset($fromFkeys[$key1]);
unset($toFkeys[$key2]);
} else {
......@@ -361,7 +361,7 @@ class Comparator
public function diffColumn(Column $column1, Column $column2)
{
$changedProperties = array();
if ( $column1->getType() != $column2->getType() ) {
if ($column1->getType() != $column2->getType()) {
$changedProperties[] = 'type';
}
......
......@@ -183,7 +183,7 @@ class DB2SchemaManager extends AbstractSchemaManager
{
if ($def == "C") {
return "CASCADE";
} else if ($def == "N") {
} elseif ($def == "N") {
return "SET NULL";
}
......
......@@ -363,4 +363,3 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
return false;
}
}
......@@ -80,7 +80,7 @@ class Index extends AbstractAsset implements Constraint
*/
protected function _addColumn($column)
{
if(is_string($column)) {
if (is_string($column)) {
$this->_columns[$column] = new Identifier($column);
} else {
throw new \InvalidArgumentException("Expecting a string as Index Column");
......@@ -204,9 +204,9 @@ class Index extends AbstractAsset implements Constraint
// overlaps. This means a primary or unique index can always fulfill the requirements of just an
// index that has no constraints.
return true;
} else if ($other->isPrimary() != $this->isPrimary()) {
} elseif ($other->isPrimary() != $this->isPrimary()) {
return false;
} else if ($other->isUnique() != $this->isUnique()) {
} elseif ($other->isUnique() != $this->isUnique()) {
return false;
}
......@@ -227,7 +227,7 @@ class Index extends AbstractAsset implements Constraint
{
if ($other->isPrimary()) {
return false;
} else if ($this->isSimpleIndex() && $other->isUnique()) {
} elseif ($this->isSimpleIndex() && $other->isUnique()) {
return false;
}
......
......@@ -62,9 +62,9 @@ class MySqlSchemaManager extends AbstractSchemaManager
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName=null)
{
foreach($tableIndexes as $k => $v) {
foreach ($tableIndexes as $k => $v) {
$v = array_change_key_case($v, CASE_LOWER);
if($v['key_name'] == 'PRIMARY') {
if ($v['key_name'] == 'PRIMARY') {
$v['primary'] = true;
} else {
$v['primary'] = false;
......@@ -135,7 +135,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
case 'real':
case 'numeric':
case 'decimal':
if(preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) {
if (preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) {
$precision = $match[1];
$scale = $match[2];
$length = null;
......@@ -208,7 +208,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
}
$result = array();
foreach($list as $constraint) {
foreach ($list as $constraint) {
$result[] = new ForeignKeyConstraint(
array_values($constraint['local']), $constraint['foreignTable'],
array_values($constraint['foreign']), $constraint['name'],
......
......@@ -70,18 +70,18 @@ class OracleSchemaManager extends AbstractSchemaManager
protected function _getPortableTableIndexesList($tableIndexes, $tableName=null)
{
$indexBuffer = array();
foreach ( $tableIndexes as $tableIndex ) {
foreach ($tableIndexes as $tableIndex) {
$tableIndex = \array_change_key_case($tableIndex, CASE_LOWER);
$keyName = strtolower($tableIndex['name']);
if ( strtolower($tableIndex['is_primary']) == "p" ) {
if (strtolower($tableIndex['is_primary']) == "p") {
$keyName = 'primary';
$buffer['primary'] = true;
$buffer['non_unique'] = false;
} else {
$buffer['primary'] = false;
$buffer['non_unique'] = ( $tableIndex['is_unique'] == 0 ) ? true : false;
$buffer['non_unique'] = ($tableIndex['is_unique'] == 0) ? true : false;
}
$buffer['key_name'] = $keyName;
$buffer['column_name'] = $tableIndex['column_name'];
......@@ -99,7 +99,7 @@ class OracleSchemaManager extends AbstractSchemaManager
$tableColumn = \array_change_key_case($tableColumn, CASE_LOWER);
$dbType = strtolower($tableColumn['data_type']);
if(strpos($dbType, "timestamp(") === 0) {
if (strpos($dbType, "timestamp(") === 0) {
if (strpos($dbType, "WITH TIME ZONE")) {
$dbType = "timestamptz";
} else {
......@@ -228,7 +228,7 @@ class OracleSchemaManager extends AbstractSchemaManager
}
$result = array();
foreach($list as $constraint) {
foreach ($list as $constraint) {
$result[] = new ForeignKeyConstraint(
array_values($constraint['local']), $constraint['foreignTable'],
array_values($constraint['foreign']), $constraint['name'],
......
......@@ -43,7 +43,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
{
$rows = $this->_conn->fetchAll("SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ '^pg_.*' and nspname != 'information_schema'");
return array_map(function($v) { return $v['schema_name']; }, $rows);
return array_map(function ($v) { return $v['schema_name']; }, $rows);
}
/**
......
......@@ -226,8 +226,8 @@ class SQLServerSchemaManager extends AbstractSchemaManager
*/
public function alterTable(TableDiff $tableDiff)
{
if(count($tableDiff->removedColumns) > 0) {
foreach($tableDiff->removedColumns as $col){
if (count($tableDiff->removedColumns) > 0) {
foreach ($tableDiff->removedColumns as $col) {
$columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName());
foreach ($this->_conn->fetchAll($columnConstraintSql) as $constraint) {
$this->_conn->exec("ALTER TABLE $tableDiff->name DROP CONSTRAINT " . $constraint['Name']);
......
......@@ -109,7 +109,7 @@ class Schema extends AbstractAsset
protected function _addTable(Table $table)
{
$tableName = $table->getFullQualifiedName($this->getName());
if(isset($this->_tables[$tableName])) {
if (isset($this->_tables[$tableName])) {
throw SchemaException::tableAlreadyExists($tableName);
}
......@@ -223,7 +223,7 @@ class Schema extends AbstractAsset
public function getSequence($sequenceName)
{
$sequenceName = $this->getFullQualifiedAssetName($sequenceName);
if(!$this->hasSequence($sequenceName)) {
if (!$this->hasSequence($sequenceName)) {
throw SchemaException::sequenceDoesNotExist($sequenceName);
}
......
......@@ -164,10 +164,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
$indexBuffer = array();
// fetch primary
$stmt = $this->_conn->executeQuery( "PRAGMA TABLE_INFO ('$tableName')" );
$stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach($indexArray as $indexColumnRow) {
if($indexColumnRow['pk'] == "1") {
foreach ($indexArray as $indexColumnRow) {
if ($indexColumnRow['pk'] == "1") {
$indexBuffer[] = array(
'key_name' => 'primary',
'primary' => true,
......@@ -178,7 +178,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
}
// fetch regular indexes
foreach($tableIndexes as $tableIndex) {
foreach ($tableIndexes as $tableIndex) {
// Ignore indexes with reserved names, e.g. autoindexes
if (strpos($tableIndex['name'], 'sqlite_') !== 0) {
$keyName = $tableIndex['name'];
......@@ -187,10 +187,10 @@ class SqliteSchemaManager extends AbstractSchemaManager
$idx['primary'] = false;
$idx['non_unique'] = $tableIndex['unique']?false:true;
$stmt = $this->_conn->executeQuery( "PRAGMA INDEX_INFO ( '{$keyName}' )" );
$stmt = $this->_conn->executeQuery("PRAGMA INDEX_INFO ('{$keyName}')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ( $indexArray as $indexColumnRow ) {
foreach ($indexArray as $indexColumnRow) {
$idx['column_name'] = $indexColumnRow['name'];
$indexBuffer[] = $idx;
}
......@@ -285,7 +285,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
if (isset($tableColumn['length'])) {
if (strpos($tableColumn['length'], ',') === false) {
$tableColumn['length'] .= ",0";
}
}
list($precision, $scale) = array_map('trim', explode(',', $tableColumn['length']));
}
$length = null;
......@@ -347,7 +347,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
}
$result = array();
foreach($list as $constraint) {
foreach ($list as $constraint) {
$result[] = new ForeignKeyConstraint(
array_values($constraint['local']), $constraint['foreignTable'],
array_values($constraint['foreign']), $constraint['name'],
......
......@@ -83,7 +83,7 @@ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer
$fullSchema = $sm->createSchema();
foreach ($fullSchema->getTables() as $table) {
if ( $dropSchema->hasTable($table->getName())) {
if ($dropSchema->hasTable($table->getName())) {
$visitor->acceptTable($table);
}
......
......@@ -151,7 +151,7 @@ class Table extends AbstractAsset
*/
public function addIndex(array $columnNames, $indexName = null, array $flags = array())
{
if($indexName == null) {
if ($indexName == null) {
$indexName = $this->_generateIdentifierName(
array_merge(array($this->getName()), $columnNames), "idx", $this->_getMaxIdentifierLength()
);
......@@ -481,7 +481,7 @@ class Table extends AbstractAsset
{
$constraint->setLocalTable($this);
if(strlen($constraint->getName())) {
if (strlen($constraint->getName())) {
$name = $constraint->getName();
} else {
$name = $this->_generateIdentifierName(
......@@ -523,7 +523,7 @@ class Table extends AbstractAsset
public function getForeignKey($constraintName)
{
$constraintName = strtolower($constraintName);
if(!$this->hasForeignKey($constraintName)) {
if (!$this->hasForeignKey($constraintName)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
}
......@@ -542,7 +542,7 @@ class Table extends AbstractAsset
public function removeForeignKey($constraintName)
{
$constraintName = strtolower($constraintName);
if(!$this->hasForeignKey($constraintName)) {
if (!$this->hasForeignKey($constraintName)) {
throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name);
}
......@@ -568,7 +568,7 @@ class Table extends AbstractAsset
}
$colNames = array_unique(array_merge($pkCols, $fkCols, array_keys($columns)));
uksort($columns, function($a, $b) use($colNames) {
uksort($columns, function ($a, $b) use ($colNames) {
return (array_search($a, $colNames) >= array_search($b, $colNames));
});
......
......@@ -55,7 +55,7 @@ class Graphviz extends AbstractVisitor
*/
public function acceptSchema(Schema $schema)
{
$this->output = 'digraph "' . sha1( mt_rand() ) . '" {' . "\n";
$this->output = 'digraph "' . sha1(mt_rand()) . '" {' . "\n";
$this->output .= 'splines = true;' . "\n";
$this->output .= 'overlap = false;' . "\n";
$this->output .= 'outputorder=edgesfirst;'."\n";
......@@ -71,7 +71,7 @@ class Graphviz extends AbstractVisitor
$this->output .= $this->createNode(
$table->getName(),
array(
'label' => $this->createTableLabel( $table ),
'label' => $this->createTableLabel($table),
'shape' => 'plaintext',
)
);
......@@ -91,7 +91,7 @@ class Graphviz extends AbstractVisitor
$label .= '<TR><TD BORDER="1" COLSPAN="3" ALIGN="CENTER" BGCOLOR="#fcaf3e"><FONT COLOR="#2e3436" FACE="Helvetica" POINT-SIZE="12">' . $table->getName() . '</FONT></TD></TR>';
// The attributes block
foreach( $table->getColumns() as $column ) {
foreach ($table->getColumns() as $column) {
$columnLabel = $column->getName();
$label .= '<TR>';
......@@ -120,8 +120,7 @@ class Graphviz extends AbstractVisitor
private function createNode($name, $options)
{
$node = $name . " [";
foreach( $options as $key => $value )
{
foreach ($options as $key => $value) {
$node .= $key . '=' . $value . ' ';
}
$node .= "]\n";
......@@ -139,8 +138,7 @@ class Graphviz extends AbstractVisitor
private function createNodeRelation($node1, $node2, $options)
{
$relation = $node1 . ' -> ' . $node2 . ' [';
foreach( $options as $key => $value )
{
foreach ($options as $key => $value) {
$relation .= $key . '=' . $value . ' ';
}
$relation .= "]\n";
......
......@@ -59,7 +59,7 @@ class RemoveNamespacedAssets extends AbstractVisitor
*/
public function acceptTable(Table $table)
{
if ( ! $table->isInDefaultNamespace($this->schema->getName()) ) {
if ( ! $table->isInDefaultNamespace($this->schema->getName())) {
$this->schema->dropTable($table->getName());
}
}
......@@ -69,7 +69,7 @@ class RemoveNamespacedAssets extends AbstractVisitor
*/
public function acceptSequence(Sequence $sequence)
{
if ( ! $sequence->isInDefaultNamespace($this->schema->getName()) ) {
if ( ! $sequence->isInDefaultNamespace($this->schema->getName())) {
$this->schema->dropSequence($sequence->getName());
}
}
......@@ -88,7 +88,7 @@ class RemoveNamespacedAssets extends AbstractVisitor
}
$foreignTable = $this->schema->getTable($fkConstraint->getForeignTableName());
if ( ! $foreignTable->isInDefaultNamespace($this->schema->getName()) ) {
if ( ! $foreignTable->isInDefaultNamespace($this->schema->getName())) {
$localTable->removeForeignKey($fkConstraint->getName());
}
}
......
......@@ -104,7 +104,7 @@ class PoolingShardConnection extends Connection
}
if ( ! ($params['shardChoser'] instanceof ShardChoser)) {
throw new \InvalidArgumentException("The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser");
throw new \InvalidArgumentException("The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser");
}
$this->connections[0] = array_merge($params, $params['global']);
......
......@@ -98,7 +98,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
*/
public function getUpdateSchema(Schema $toSchema, $noDrops = false)
{
return $this->work($toSchema, function($synchronizer, $schema) use ($noDrops) {
return $this->work($toSchema, function ($synchronizer, $schema) use ($noDrops) {
return $synchronizer->getUpdateSchema($schema, $noDrops);
});
}
......@@ -108,7 +108,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
*/
public function getDropSchema(Schema $dropSchema)
{
return $this->work($dropSchema, function($synchronizer, $schema) {
return $this->work($dropSchema, function ($synchronizer, $schema) {
return $synchronizer->getDropSchema($schema);
});
}
......@@ -206,7 +206,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
$table->addOption(self::FEDERATION_DISTRIBUTION_NAME, $this->shardManager->getDistributionKey());
}
if ( $table->hasOption(self::FEDERATION_TABLE_FEDERATED) !== $isFederation) {
if ($table->hasOption(self::FEDERATION_TABLE_FEDERATED) !== $isFederation) {
$partitionedSchema->dropTable($table->getName());
} else {
foreach ($table->getForeignKeys() as $fk) {
......
......@@ -125,7 +125,7 @@ class MultiTenantVisitor implements Visitor
foreach ($table->getIndexes() as $index) {
if ($index->isPrimary() && ! $index->hasFlag('nonclustered')) {
return $index;
} else if ($index->hasFlag('clustered')) {
} elseif ($index->hasFlag('clustered')) {
return $index;
}
}
......
......@@ -228,7 +228,7 @@ class Statement implements \IteratorAggregate, DriverStatement
{
if ($arg2 === null) {
return $this->stmt->setFetchMode($fetchMode);
} else if ($arg3 === null) {
} elseif ($arg3 === null) {
return $this->stmt->setFetchMode($fetchMode, $arg2);
}
......
......@@ -65,19 +65,18 @@ EOT
if (($fileNames = $input->getArgument('file')) !== null) {
foreach ((array) $fileNames as $fileName) {
$filePath = realpath($fileName);
// Phar compatibility.
if (false === $filePath) {
$filePath = $fileName;
}
if ( ! file_exists($filePath)) {
throw new \InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not exist.", $filePath)
);
} else if ( ! is_readable($filePath)) {
} elseif ( ! is_readable($filePath)) {
throw new \InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath)
);
......
......@@ -53,11 +53,11 @@ class BigIntType extends Type
return \PDO::PARAM_STR;
}
/**
/**
* {@inheritdoc}
*/
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
{
return (null === $value) ? null : (string) $value;
}
}
......@@ -47,8 +47,8 @@ class BlobType extends Type
if (is_string($value)) {
$value = fopen('data://text/plain;base64,' . base64_encode($value), 'r');
}
}
if ( ! is_resource($value)) {
throw ConversionException::conversionFailed($value, self::BLOB);
}
......
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