Commit 89c7b527 authored by Guilherme Blanco's avatar Guilherme Blanco

Merge pull request #429 from deeky666/fix-cs

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