Commit 8c9e9e81 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Fix CS: if (!$var) to if ( ! $var)

parent 72465c6f
......@@ -109,7 +109,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
$this->statement->closeCursor();
if ($this->emptied && $this->data !== null) {
$data = $this->resultCache->fetch($this->cacheKey);
if (!$data) {
if ( ! $data) {
$data = array();
}
$data[$this->realKey] = $this->data;
......
......@@ -652,7 +652,7 @@ class Connection implements DriverConnection
public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qcp)
{
$resultCache = $qcp->getResultCacheDriver() ?: $this->_config->getResultCacheImpl();
if (!$resultCache) {
if ( ! $resultCache) {
throw CacheException::noResultDriverConfigured();
}
......@@ -872,7 +872,7 @@ class Connection implements DriverConnection
throw ConnectionException::mayNotAlterNestedTransactionWithSavepointsInTransaction();
}
if (!$this->_platform->supportsSavepoints()) {
if ( ! $this->_platform->supportsSavepoints()) {
throw ConnectionException::savepointsNotSupported();
}
......@@ -1025,7 +1025,7 @@ class Connection implements DriverConnection
*/
public function createSavepoint($savepoint)
{
if (!$this->_platform->supportsSavepoints()) {
if ( ! $this->_platform->supportsSavepoints()) {
throw ConnectionException::savepointsNotSupported();
}
......@@ -1041,7 +1041,7 @@ class Connection implements DriverConnection
*/
public function releaseSavepoint($savepoint)
{
if (!$this->_platform->supportsSavepoints()) {
if ( ! $this->_platform->supportsSavepoints()) {
throw ConnectionException::savepointsNotSupported();
}
......@@ -1059,7 +1059,7 @@ class Connection implements DriverConnection
*/
public function rollbackSavepoint($savepoint)
{
if (!$this->_platform->supportsSavepoints()) {
if ( ! $this->_platform->supportsSavepoints()) {
throw ConnectionException::savepointsNotSupported();
}
......
......@@ -34,7 +34,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
} else {
$this->_conn = db2_connect($params['dbname'], $username, $password, $driverOptions);
}
if (!$this->_conn) {
if ( ! $this->_conn) {
throw new DB2Exception(db2_conn_errormsg());
}
}
......@@ -42,7 +42,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
public function prepare($sql)
{
$stmt = @db2_prepare($this->_conn, $sql);
if (!$stmt) {
if ( ! $stmt) {
throw new DB2Exception(db2_stmt_errormsg());
}
return new DB2Statement($stmt);
......@@ -112,4 +112,4 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
1 => $this->errorCode(),
);
}
}
\ No newline at end of file
}
......@@ -77,7 +77,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
public function closeCursor()
{
if (!$this->_stmt) {
if ( ! $this->_stmt) {
return false;
}
......@@ -93,7 +93,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
public function columnCount()
{
if (!$this->_stmt) {
if ( ! $this->_stmt) {
return false;
}
return db2_num_fields($this->_stmt);
......@@ -123,7 +123,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
public function execute($params = null)
{
if (!$this->_stmt) {
if ( ! $this->_stmt) {
return false;
}
......
......@@ -37,7 +37,7 @@ class MysqliConnection implements Connection
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket');
$this->_conn = mysqli_init();
if (!$this->_conn->real_connect($params['host'], $username, $password, $params['dbname'], $port, $socket)) {
if ( ! $this->_conn->real_connect($params['host'], $username, $password, $params['dbname'], $port, $socket)) {
throw new MysqliException($this->_conn->connect_error, $this->_conn->connect_errno);
}
......
......@@ -131,7 +131,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
{
if (null !== $this->_bindedValues) {
if (null !== $params) {
if (!$this->_bindValues($params)) {
if ( ! $this->_bindValues($params)) {
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
}
} else {
......@@ -141,7 +141,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
}
}
if (!$this->_stmt->execute()) {
if ( ! $this->_stmt->execute()) {
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
}
......
......@@ -44,7 +44,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
}
$this->_dbh = @oci_connect($username, $password, $db, $charset, $sessionMode);
if (!$this->_dbh) {
if ( ! $this->_dbh) {
throw OCI8Exception::fromErrorInfo(oci_error());
}
}
......
......@@ -41,7 +41,7 @@ class SQLSrvConnection implements \Doctrine\DBAL\Driver\Connection
public function __construct($serverName, $connectionOptions)
{
$this->conn = sqlsrv_connect($serverName, $connectionOptions);
if (!$this->conn) {
if ( ! $this->conn) {
throw SQLSrvException::fromSqlSrvErrors();
}
$this->lastInsertId = new LastInsertId();
......
......@@ -33,7 +33,7 @@ class SQLSrvException extends \Doctrine\DBAL\DBALException
foreach ($errors as $error) {
$message .= "SQLSTATE [".$error['SQLSTATE'].", ".$error['code']."]: ". $error['message']."\n";
}
if (!$message) {
if ( ! $message) {
$message = "SQL Server error occured but no error message was retrieved from driver.";
}
......
......@@ -164,7 +164,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
}
$this->stmt = sqlsrv_query($this->conn, $this->sql, $this->params);
if (!$this->stmt) {
if ( ! $this->stmt) {
throw SQLSrvException::fromSqlSrvErrors();
}
......
......@@ -53,7 +53,7 @@ class SchemaDropTableEventArgs extends SchemaEventArgs
*/
public function __construct($table, AbstractPlatform $platform)
{
if (!$table instanceof Table && !is_string($table)) {
if ( ! $table instanceof Table && !is_string($table)) {
throw new \InvalidArgumentException('SchemaCreateTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
}
......
......@@ -1387,7 +1387,7 @@ abstract class AbstractPlatform
return false;
}
if (!$this->_eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) {
if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) {
return false;
}
......@@ -1410,7 +1410,7 @@ abstract class AbstractPlatform
return false;
}
if (!$this->_eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) {
if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) {
return false;
}
......@@ -1433,7 +1433,7 @@ abstract class AbstractPlatform
return false;
}
if (!$this->_eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) {
if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) {
return false;
}
......@@ -1457,7 +1457,7 @@ abstract class AbstractPlatform
return false;
}
if (!$this->_eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) {
if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) {
return false;
}
......@@ -1478,7 +1478,7 @@ abstract class AbstractPlatform
return false;
}
if (!$this->_eventManager->hasListeners(Events::onSchemaAlterTable)) {
if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTable)) {
return false;
}
......@@ -2672,7 +2672,7 @@ abstract class AbstractPlatform
{
$class = $this->getReservedKeywordsClass();
$keywords = new $class;
if (!$keywords instanceof \Doctrine\DBAL\Platforms\Keywords\KeywordList) {
if ( ! $keywords instanceof \Doctrine\DBAL\Platforms\Keywords\KeywordList) {
throw DBALException::notSupported(__METHOD__);
}
return $keywords;
......
......@@ -413,7 +413,7 @@ class DB2Platform extends AbstractPlatform
$tableSql = array();
if (!$this->onSchemaAlterTable($diff, $tableSql)) {
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if (count($queryParts) > 0) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(" ", $queryParts);
}
......
......@@ -347,7 +347,7 @@ class DrizzlePlatform extends AbstractPlatform
$sql = array();
$tableSql = array();
if (!$this->onSchemaAlterTable($diff, $tableSql)) {
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if (count($queryParts) > 0) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(", ", $queryParts);
}
......
......@@ -71,7 +71,7 @@ class ReservedKeywordsValidator implements Visitor
private function addViolation($asset, $violatedPlatforms)
{
if (!$violatedPlatforms) {
if ( ! $violatedPlatforms) {
return;
}
......
......@@ -505,7 +505,7 @@ class MySqlPlatform extends AbstractPlatform
$sql = array();
$tableSql = array();
if (!$this->onSchemaAlterTable($diff, $tableSql)) {
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if (count($queryParts) > 0) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(", ", $queryParts);
}
......
......@@ -624,7 +624,7 @@ LEFT JOIN user_cons_columns r_cols
$tableSql = array();
if (!$this->onSchemaAlterTable($diff, $tableSql)) {
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if ($diff->newName !== false) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME TO ' . $diff->newName;
}
......
......@@ -457,7 +457,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$tableSql = array();
if (!$this->onSchemaAlterTable($diff, $tableSql)) {
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if ($diff->newName !== false) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME TO ' . $diff->newName;
}
......
......@@ -509,7 +509,7 @@ class SQLServerPlatform extends AbstractPlatform
{
$trimFn = '';
if (!$char) {
if ( ! $char) {
if ($pos == self::TRIM_LEADING) {
$trimFn = 'LTRIM';
} else if ($pos == self::TRIM_TRAILING) {
......@@ -692,7 +692,7 @@ class SQLServerPlatform extends AbstractPlatform
} else {
$orderby = stristr($query, 'ORDER BY');
if (!$orderby) {
if ( ! $orderby) {
$over = 'ORDER BY (SELECT 0)';
} else {
$over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);
......
......@@ -134,7 +134,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
$iterateRow = $this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM);
$fixCase = !is_null($this->case) && ($fetchStyle == PDO::FETCH_ASSOC || $fetchStyle == PDO::FETCH_BOTH) && ($this->portability & Connection::PORTABILITY_FIX_CASE);
if (!$iterateRow && !$fixCase) {
if ( ! $iterateRow && !$fixCase) {
return $rows;
}
......@@ -147,7 +147,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
protected function fixRow($row, $iterateRow, $fixCase)
{
if (!$row) {
if ( ! $row) {
return $row;
}
......
......@@ -123,7 +123,7 @@ abstract class AbstractAsset
public function getFullQualifiedName($defaultNamespaceName)
{
$name = $this->getName();
if (!$this->_namespace) {
if ( ! $this->_namespace) {
$name = $defaultNamespaceName . "." . $name;
}
return strtolower($name);
......
......@@ -148,7 +148,7 @@ abstract class AbstractSchemaManager
*/
public function listTableColumns($table, $database = null)
{
if (!$database) {
if ( ! $database) {
$database = $this->_conn->getDatabase();
}
......@@ -212,7 +212,7 @@ abstract class AbstractSchemaManager
protected function filterAssetNames($assetNames)
{
$filterExpr = $this->getFilterSchemaAssetsExpression();
if (!$filterExpr) {
if ( ! $filterExpr) {
return $assetNames;
}
return array_values (
......@@ -668,7 +668,7 @@ abstract class AbstractSchemaManager
$column = $eventArgs->getColumn();
}
if (!$defaultPrevented) {
if ( ! $defaultPrevented) {
$column = $this->_getPortableTableColumnDefinition($tableColumn);
}
......@@ -733,7 +733,7 @@ abstract class AbstractSchemaManager
$index = $eventArgs->getIndex();
}
if (!$defaultPrevented) {
if ( ! $defaultPrevented) {
$index = new Index($data['name'], $data['columns'], $data['unique'], $data['primary'], $data['flags']);
}
......
......@@ -100,7 +100,7 @@ class Comparator
foreach ($toSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getShortestName($toSchema->getName());
if (!$fromSchema->hasSequence($sequenceName)) {
if ( ! $fromSchema->hasSequence($sequenceName)) {
$diff->newSequences[] = $sequence;
} else {
if ($this->diffSequence($sequence, $fromSchema->getSequence($sequenceName))) {
......@@ -111,7 +111,7 @@ class Comparator
foreach ($fromSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getShortestName($fromSchema->getName());
if (!$toSchema->hasSequence($sequenceName)) {
if ( ! $toSchema->hasSequence($sequenceName)) {
$diff->removedSequences[] = $sequence;
}
}
......
......@@ -156,7 +156,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$index = $eventArgs->getIndex();
}
if (!$defaultPrevented) {
if ( ! $defaultPrevented) {
$index = new Index($data['name'], $data['columns'], $data['unique'], $data['primary']);
}
......
......@@ -160,7 +160,7 @@ class Index extends AbstractAsset implements Constraint
$sameColumns = $this->spansColumns($other->getColumns());
if ($sameColumns) {
if (!$this->isUnique() && !$this->isPrimary()) {
if ( ! $this->isUnique() && !$this->isPrimary()) {
// this is a special case: If the current key is neither primary or unique, any uniqe or
// primary key will always have the same effect for the index and there cannot be any constraint
// overlaps. This means a primary or unique index can always fullfill the requirements of just an
......
......@@ -144,7 +144,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$index = $eventArgs->getIndex();
}
if (!$defaultPrevented) {
if ( ! $defaultPrevented) {
$index = new Index($data['name'], $data['columns'], $data['unique'], $data['primary']);
}
......
......@@ -180,7 +180,7 @@ class Table extends AbstractAsset
public function dropIndex($indexName)
{
$indexName = strtolower($indexName);
if (!$this->hasIndex($indexName)) {
if ( ! $this->hasIndex($indexName)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name);
}
unset($this->_indexes[$indexName]);
......@@ -549,7 +549,7 @@ class Table extends AbstractAsset
public function getColumn($columnName)
{
$columnName = strtolower($this->trimQuotes($columnName));
if (!$this->hasColumn($columnName)) {
if ( ! $this->hasColumn($columnName)) {
throw SchemaException::columnDoesNotExist($columnName, $this->_name);
}
......@@ -561,7 +561,7 @@ class Table extends AbstractAsset
*/
public function getPrimaryKey()
{
if (!$this->hasPrimaryKey()) {
if ( ! $this->hasPrimaryKey()) {
return null;
}
return $this->getIndex($this->_primaryKeyName);
......@@ -594,7 +594,7 @@ class Table extends AbstractAsset
public function getIndex($indexName)
{
$indexName = strtolower($indexName);
if (!$this->hasIndex($indexName)) {
if ( ! $this->hasIndex($indexName)) {
throw SchemaException::indexDoesNotExist($indexName, $this->_name);
}
return $this->_indexes[$indexName];
......
......@@ -97,7 +97,7 @@ EOT
$conn = $this->getHelper('db')->getConnection();
$keywordLists = (array)$input->getOption('list');
if (!$keywordLists) {
if ( ! $keywordLists) {
$keywordLists = array('mysql', 'pgsql', 'sqlite', 'oracle', 'mssql');
}
......
......@@ -51,7 +51,7 @@ class DateTimeType extends Type
}
$val = \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value);
if (!$val) {
if ( ! $val) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeFormatString());
}
return $val;
......
......@@ -71,7 +71,7 @@ class DateTimeTzType extends Type
}
$val = \DateTime::createFromFormat($platform->getDateTimeTzFormatString(), $value);
if (!$val) {
if ( ! $val) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateTimeTzFormatString());
}
return $val;
......
......@@ -51,7 +51,7 @@ class DateType extends Type
}
$val = \DateTime::createFromFormat('!'.$platform->getDateFormatString(), $value);
if (!$val) {
if ( ! $val) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getDateFormatString());
}
return $val;
......
......@@ -60,7 +60,7 @@ class TimeType extends Type
}
$val = \DateTime::createFromFormat($platform->getTimeFormatString(), $value);
if (!$val) {
if ( ! $val) {
throw ConversionException::conversionFailedFormat($value, $this->getName(), $platform->getTimeFormatString());
}
return $val;
......
......@@ -52,7 +52,7 @@ class VarDateTimeType extends DateTimeType
}
$val = date_create($value);
if (!$val) {
if ( ! $val) {
throw ConversionException::conversionFailed($value, $this->getName());
}
return $val;
......
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