From ba4561f74feb4f8060f0eb9de77daac5e1a901ce Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Tue, 16 Dec 2014 21:21:53 +0100 Subject: [PATCH] minor phpdoc fixes in the remaining files after pr #746 --- .../DBAL/Connections/MasterSlaveConnection.php | 2 +- .../DBAL/Driver/DrizzlePDOMySql/Connection.php | 3 ++- .../DBAL/Driver/IBMDB2/DB2Connection.php | 3 +++ .../DBAL/Driver/Mysqli/MysqliConnection.php | 2 ++ .../DBAL/Driver/Mysqli/MysqliStatement.php | 7 +++++-- .../DBAL/Driver/OCI8/OCI8Statement.php | 2 +- .../DBAL/Driver/SQLSrv/SQLSrvStatement.php | 2 +- lib/Doctrine/DBAL/Id/TableGenerator.php | 2 +- .../Query/Expression/ExpressionBuilder.php | 2 +- lib/Doctrine/DBAL/Query/QueryBuilder.php | 1 + lib/Doctrine/DBAL/Schema/AbstractAsset.php | 3 ++- .../DBAL/Schema/AbstractSchemaManager.php | 6 ++++-- lib/Doctrine/DBAL/Schema/Column.php | 18 ++++++++++-------- lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 4 ++-- .../DBAL/Schema/DrizzleSchemaManager.php | 18 +++++++++--------- .../DBAL/Schema/ForeignKeyConstraint.php | 1 + lib/Doctrine/DBAL/Schema/Index.php | 1 + .../DBAL/Schema/PostgreSqlSchemaManager.php | 4 ++-- .../DBAL/Schema/SQLServerSchemaManager.php | 4 ++-- lib/Doctrine/DBAL/Schema/SchemaConfig.php | 4 ++-- lib/Doctrine/DBAL/Schema/SchemaException.php | 2 +- .../DBAL/Schema/SqliteSchemaManager.php | 3 ++- .../AbstractSchemaSynchronizer.php | 2 +- lib/Doctrine/DBAL/Schema/Table.php | 4 ++-- .../Visitor/CreateSchemaSqlCollector.php | 2 +- .../DBAL/Sharding/PoolingShardConnection.php | 3 ++- .../SQLAzureFederationsSynchronizer.php | 1 + .../Sharding/SQLAzure/SQLAzureShardManager.php | 5 +++-- .../Tools/Console/Command/ImportCommand.php | 2 +- .../Console/Command/ReservedWordsCommand.php | 2 +- lib/Doctrine/DBAL/Types/DateTimeTzType.php | 12 ++++++------ lib/Doctrine/DBAL/Types/VarDateTimeType.php | 1 + 32 files changed, 75 insertions(+), 53 deletions(-) diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 2be19c245c8..d38e41374d5 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -121,7 +121,7 @@ public function __construct(array $params, Driver $driver, Configuration $config $params['slaves'][$slaveKey]['driver'] = $params['driver']; } - $this->keepSlave = isset($params['keepSlave']) ? (bool)$params['keepSlave'] : false; + $this->keepSlave = isset($params['keepSlave']) ? (bool) $params['keepSlave'] : false; parent::__construct($params, $driver, $config, $eventManager); } diff --git a/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php b/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php index 2b46c992561..92ca6601f43 100644 --- a/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php +++ b/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php @@ -27,7 +27,7 @@ class Connection extends \Doctrine\DBAL\Driver\PDOConnection /** * {@inheritdoc} */ - public function quote($value, $type=\PDO::PARAM_STR) + public function quote($value, $type = \PDO::PARAM_STR) { if (\PDO::PARAM_BOOL === $type) { if ($value) { @@ -36,6 +36,7 @@ public function quote($value, $type=\PDO::PARAM_STR) return 'false'; } } + return parent::quote($value, $type); } } diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php index 1772eb56fba..0e809e2f5cf 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php @@ -78,6 +78,7 @@ public function prepare($sql) if ( ! $stmt) { throw new DB2Exception(db2_stmt_errormsg()); } + return new DB2Statement($stmt); } @@ -90,6 +91,7 @@ public function query() $sql = $args[0]; $stmt = $this->prepare($sql); $stmt->execute(); + return $stmt; } @@ -113,6 +115,7 @@ public function exec($statement) { $stmt = $this->prepare($statement); $stmt->execute(); + return $stmt->rowCount(); } diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php index 0452b89e3e2..83935a37bc2 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php @@ -135,6 +135,7 @@ public function query() $sql = $args[0]; $stmt = $this->prepare($sql); $stmt->execute(); + return $stmt; } @@ -172,6 +173,7 @@ public function lastInsertId($name = null) public function beginTransaction() { $this->_conn->query('START TRANSACTION'); + return true; } diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php index f3a9f5cda97..17264604a94 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php @@ -97,7 +97,7 @@ public function __construct(\mysqli $conn, $prepareString) $paramCount = $this->_stmt->param_count; if (0 < $paramCount) { $this->types = str_repeat('s', $paramCount); - $this->_bindedValues = array_fill(1 , $paramCount, null); + $this->_bindedValues = array_fill(1, $paramCount, null); } } @@ -178,7 +178,7 @@ public function execute($params = null) $meta->free(); $this->_columnNames = $columnNames; - $this->_rowBindedValues = array_fill(0, count($columnNames), NULL); + $this->_rowBindedValues = array_fill(0, count($columnNames), null); $refs = array(); foreach ($this->_rowBindedValues as $key => &$value) { @@ -228,6 +228,7 @@ private function _fetch() foreach ($this->_rowBindedValues as $v) { $values[] = $v; } + return $values; } @@ -260,6 +261,7 @@ public function fetch($fetchMode = null) case PDO::FETCH_BOTH: $ret = array_combine($this->_columnNames, $values); $ret += $values; + return $ret; default: @@ -335,6 +337,7 @@ public function rowCount() if (false === $this->_columnNames) { return $this->_stmt->affected_rows; } + return $this->_stmt->num_rows; } diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php index 9174f355a09..3270a0b3936 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php @@ -272,7 +272,7 @@ public function fetchAll($fetchMode = null) } oci_fetch_all($this->_sth, $result, 0, -1, - self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS); + self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS); if ($fetchMode == PDO::FETCH_COLUMN) { $result = $result[0]; diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php index 3f902fe7aaa..ead250c1857 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php @@ -126,7 +126,7 @@ public function __construct($conn, $sql, LastInsertId $lastInsertId = null) */ public function bindValue($param, $value, $type = null) { - return $this->bindParam($param, $value, $type,null); + return $this->bindParam($param, $value, $type, null); } /** diff --git a/lib/Doctrine/DBAL/Id/TableGenerator.php b/lib/Doctrine/DBAL/Id/TableGenerator.php index 090227a8bab..62d6fcb8ef1 100644 --- a/lib/Doctrine/DBAL/Id/TableGenerator.php +++ b/lib/Doctrine/DBAL/Id/TableGenerator.php @@ -155,7 +155,7 @@ public function nextValue($sequenceName) $this->conn->commit(); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->conn->rollback(); throw new \Doctrine\DBAL\DBALException("Error occurred while generating ID with TableGenerator, aborted generation: " . $e->getMessage(), 0, $e); } diff --git a/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php b/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php index 682eaf6424f..2736fcf2264 100644 --- a/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php +++ b/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php @@ -263,7 +263,7 @@ public function like($x, $y) * Creates a NOT LIKE() comparison expression with the given arguments. * * @param string $x Field in string format to be inspected by NOT LIKE() comparison. - * @param mixed $y Argument to be used in NOT LIKE() comparison. + * @param mixed $y Argument to be used in NOT LIKE() comparison. * * @return string */ diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php index 6a94f9eb302..6ec27c0bfde 100644 --- a/lib/Doctrine/DBAL/Query/QueryBuilder.php +++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php @@ -1293,6 +1293,7 @@ public function createPositionalParameter($value, $type = \PDO::PARAM_STR) { $this->boundCounter++; $this->setParameter($this->boundCounter, $value, $type); + return "?"; } diff --git a/lib/Doctrine/DBAL/Schema/AbstractAsset.php b/lib/Doctrine/DBAL/Schema/AbstractAsset.php index 685a57ad1fc..051dce92c4f 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractAsset.php +++ b/lib/Doctrine/DBAL/Schema/AbstractAsset.php @@ -99,7 +99,7 @@ public function getNamespaceName() * The shortest name is stripped of the default namespace. All other * namespaced elements are returned as full-qualified names. * - * @param string + * @param string $defaultNamespaceName * * @return string */ @@ -180,6 +180,7 @@ public function getName() if ($this->_namespace) { return $this->_namespace . "." . $this->_name; } + return $this->_name; } diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index e220ff0877e..19dfa9369b4 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -202,7 +202,7 @@ public function listTableIndexes($table) */ public function tablesExist($tableNames) { - $tableNames = array_map('strtolower', (array)$tableNames); + $tableNames = array_map('strtolower', (array) $tableNames); return count($tableNames) == count(\array_intersect($tableNames, array_map('strtolower', $this->listTableNames()))); } @@ -237,9 +237,10 @@ protected function filterAssetNames($assetNames) return $assetNames; } - return array_values ( + return array_values( array_filter($assetNames, function ($assetName) use ($filterExpr) { $assetName = ($assetName instanceof AbstractAsset) ? $assetName->getName() : $assetName; + return preg_match($filterExpr, $assetName); }) ); @@ -952,6 +953,7 @@ protected function _getPortableUserDefinition($user) /** * @param array $views + * * @return array */ protected function _getPortableViewsList($views) diff --git a/lib/Doctrine/DBAL/Schema/Column.php b/lib/Doctrine/DBAL/Schema/Column.php index 623382660c8..192ce1d2eef 100644 --- a/lib/Doctrine/DBAL/Schema/Column.php +++ b/lib/Doctrine/DBAL/Schema/Column.php @@ -99,8 +99,8 @@ class Column extends AbstractAsset * Creates a new Column. * * @param string $columnName - * @param Type $type - * @param array $options + * @param Type $type + * @param array $options */ public function __construct($columnName, Type $type, array $options=array()) { @@ -134,6 +134,7 @@ public function setOptions(array $options) public function setType(Type $type) { $this->_type = $type; + return $this; } @@ -145,7 +146,7 @@ public function setType(Type $type) public function setLength($length) { if ($length !== null) { - $this->_length = (int)$length; + $this->_length = (int) $length; } else { $this->_length = null; } @@ -164,7 +165,7 @@ public function setPrecision($precision) $precision = 10; // defaults to 10 when no valid precision is given. } - $this->_precision = (int)$precision; + $this->_precision = (int) $precision; return $this; } @@ -180,7 +181,7 @@ public function setScale($scale) $scale = 0; } - $this->_scale = (int)$scale; + $this->_scale = (int) $scale; return $this; } @@ -192,7 +193,7 @@ public function setScale($scale) */ public function setUnsigned($unsigned) { - $this->_unsigned = (bool)$unsigned; + $this->_unsigned = (bool) $unsigned; return $this; } @@ -204,7 +205,7 @@ public function setUnsigned($unsigned) */ public function setFixed($fixed) { - $this->_fixed = (bool)$fixed; + $this->_fixed = (bool) $fixed; return $this; } @@ -216,7 +217,7 @@ public function setFixed($fixed) */ public function setNotnull($notnull) { - $this->_notnull = (bool)$notnull; + $this->_notnull = (bool) $notnull; return $this; } @@ -386,6 +387,7 @@ public function getAutoincrement() public function setAutoincrement($flag) { $this->_autoincrement = $flag; + return $this; } diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index 5ab87da55c0..ff914c60f9c 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -87,8 +87,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) $options = array( 'length' => $length, - 'unsigned' => (bool)$unsigned, - 'fixed' => (bool)$fixed, + 'unsigned' => (bool) $unsigned, + 'fixed' => (bool) $fixed, 'default' => $default, 'autoincrement' => (boolean) $tableColumn['autoincrement'], 'notnull' => (bool) ($tableColumn['nulls'] == 'N'), diff --git a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php index 4e72310fd14..e9503c359a9 100644 --- a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php @@ -40,12 +40,12 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); $options = array( - 'notnull' => !(bool)$tableColumn['IS_NULLABLE'], - 'length' => (int)$tableColumn['CHARACTER_MAXIMUM_LENGTH'], + 'notnull' => !(bool) $tableColumn['IS_NULLABLE'], + 'length' => (int) $tableColumn['CHARACTER_MAXIMUM_LENGTH'], 'default' => isset($tableColumn['COLUMN_DEFAULT']) ? $tableColumn['COLUMN_DEFAULT'] : null, - 'autoincrement' => (bool)$tableColumn['IS_AUTO_INCREMENT'], - 'scale' => (int)$tableColumn['NUMERIC_SCALE'], - 'precision' => (int)$tableColumn['NUMERIC_PRECISION'], + 'autoincrement' => (bool) $tableColumn['IS_AUTO_INCREMENT'], + 'scale' => (int) $tableColumn['NUMERIC_SCALE'], + 'precision' => (int) $tableColumn['NUMERIC_PRECISION'], 'comment' => isset($tableColumn['COLUMN_COMMENT']) && '' !== $tableColumn['COLUMN_COMMENT'] ? $tableColumn['COLUMN_COMMENT'] : null, @@ -86,15 +86,15 @@ public function _getPortableTableForeignKeyDefinition($tableForeignKey) $columns[] = trim($value, ' `'); } - $ref_columns = array(); + $refColumns = array(); foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) { - $ref_columns[] = trim($value, ' `'); + $refColumns[] = trim($value, ' `'); } return new ForeignKeyConstraint( $columns, $tableForeignKey['REFERENCED_TABLE_NAME'], - $ref_columns, + $refColumns, $tableForeignKey['CONSTRAINT_NAME'], array( 'onUpdate' => $tableForeignKey['UPDATE_RULE'], @@ -110,7 +110,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null { $indexes = array(); foreach ($tableIndexes as $k) { - $k['primary'] = (boolean)$k['primary']; + $k['primary'] = (boolean) $k['primary']; $indexes[] = $k; } diff --git a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php index bf5ed32dcc3..66f35f90705 100644 --- a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php +++ b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php @@ -231,6 +231,7 @@ public function getForeignTableName() public function getUnqualifiedForeignTableName() { $parts = explode(".", $this->_foreignTableName->getName()); + return strtolower(end($parts)); } diff --git a/lib/Doctrine/DBAL/Schema/Index.php b/lib/Doctrine/DBAL/Schema/Index.php index 28b5f802277..bc5cd93dc6f 100644 --- a/lib/Doctrine/DBAL/Schema/Index.php +++ b/lib/Doctrine/DBAL/Schema/Index.php @@ -339,6 +339,7 @@ public function getOptions() /** * Return whether the two indexes have the same partial index * @param \Doctrine\DBAL\Schema\Index $other + * * @return boolean */ private function samePartialIndex(Index $other) diff --git a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php index c9cbe4e971b..4b4ef2d9030 100644 --- a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php @@ -124,8 +124,8 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) } return new ForeignKeyConstraint( - $localColumns, $foreignTable, $foreignColumns, $tableForeignKey['conname'], - array('onUpdate' => $onUpdate, 'onDelete' => $onDelete) + $localColumns, $foreignTable, $foreignColumns, $tableForeignKey['conname'], + array('onUpdate' => $onUpdate, 'onDelete' => $onDelete) ); } diff --git a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php index fc6fac1b7c6..b56f8b29179 100644 --- a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php @@ -206,13 +206,13 @@ public function listTableIndexes($table) try { $tableIndexes = $this->_conn->fetchAll($sql); - } catch(\PDOException $e) { + } catch (\PDOException $e) { if ($e->getCode() == "IMSSP") { return array(); } else { throw $e; } - } catch(SQLSrvException $e) { + } catch (SQLSrvException $e) { if (strpos($e->getMessage(), 'SQLSTATE [01000, 15472]') === 0) { return array(); } else { diff --git a/lib/Doctrine/DBAL/Schema/SchemaConfig.php b/lib/Doctrine/DBAL/Schema/SchemaConfig.php index e8ba6fd56b1..cc23237d87b 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaConfig.php +++ b/lib/Doctrine/DBAL/Schema/SchemaConfig.php @@ -63,7 +63,7 @@ public function hasExplicitForeignKeyIndexes() */ public function setExplicitForeignKeyIndexes($flag) { - $this->hasExplicitForeignKeyIndexes = (bool)$flag; + $this->hasExplicitForeignKeyIndexes = (bool) $flag; } /** @@ -73,7 +73,7 @@ public function setExplicitForeignKeyIndexes($flag) */ public function setMaxIdentifierLength($length) { - $this->maxIdentifierLength = (int)$length; + $this->maxIdentifierLength = (int) $length; } /** diff --git a/lib/Doctrine/DBAL/Schema/SchemaException.php b/lib/Doctrine/DBAL/Schema/SchemaException.php index 72a8968efca..152f374da09 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaException.php +++ b/lib/Doctrine/DBAL/Schema/SchemaException.php @@ -176,6 +176,6 @@ static public function namedForeignKeyRequired(Table $localTable, ForeignKeyCons */ static public function alterTableChangeNotSupported($changeName) { - return new self ("Alter table change not supported, given '$changeName'"); + return new self("Alter table change not supported, given '$changeName'"); } } diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index b1dacb25a0a..08c90cf984d 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -172,6 +172,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) if ($a['pk'] == $b['pk']) { return $a['cid'] - $b['cid']; } + return $a['pk'] - $b['pk']; }); foreach ($indexArray as $indexColumnRow) { @@ -286,7 +287,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $fixed = false; $type = $this->_platform->getDoctrineTypeMapping($dbType); $default = $tableColumn['dflt_value']; - if ($default == 'NULL') { + if ($default == 'NULL') { $default = null; } if ($default !== null) { diff --git a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php index fc1bec1be06..3158df47de1 100644 --- a/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php +++ b/lib/Doctrine/DBAL/Schema/Synchronizer/AbstractSchemaSynchronizer.php @@ -47,7 +47,7 @@ protected function processSqlSafely(array $sql) foreach ($sql as $s) { try { $this->conn->exec($s); - } catch(\Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php index bb4467344fe..e5d98e1ab77 100644 --- a/lib/Doctrine/DBAL/Schema/Table.php +++ b/lib/Doctrine/DBAL/Schema/Table.php @@ -383,7 +383,7 @@ public function dropColumn($columnName) */ public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=array(), $constraintName = null) { - $constraintName = $constraintName ?: $this->_generateIdentifierName(array_merge((array)$this->getName(), $localColumnNames), "fk", $this->_getMaxIdentifierLength()); + $constraintName = $constraintName ?: $this->_generateIdentifierName(array_merge((array) $this->getName(), $localColumnNames), "fk", $this->_getMaxIdentifierLength()); return $this->addNamedForeignKeyConstraint($constraintName, $foreignTable, $localColumnNames, $foreignColumnNames, $options); } @@ -532,7 +532,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) $name = $constraint->getName(); } else { $name = $this->_generateIdentifierName( - array_merge((array)$this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength() + array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength() ); } $name = $this->normalizeIdentifier($name); diff --git a/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php b/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php index b8032778d0c..5e0c6ed437e 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php @@ -103,7 +103,7 @@ public function acceptSequence(Sequence $sequence) { $this->createSequenceQueries = array_merge( $this->createSequenceQueries, - (array)$this->platform->getCreateSequenceSQL($sequence) + (array) $this->platform->getCreateSequenceSQL($sequence) ); } diff --git a/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php b/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php index e0ee4992f70..3b6c6e1067d 100644 --- a/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php +++ b/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php @@ -151,10 +151,11 @@ public function connect($shardId = null) throw new ShardingException("Cannot switch shard when transaction is active."); } - $this->activeShardId = (int)$shardId; + $this->activeShardId = (int) $shardId; if (isset($this->activeConnections[$this->activeShardId])) { $this->_conn = $this->activeConnections[$this->activeShardId]; + return false; } diff --git a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php index 0983e4ebbf4..edda835876b 100644 --- a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php +++ b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php @@ -280,6 +280,7 @@ private function getFederationTypeDefaultValue() $defaultValue = ''; break; } + return $defaultValue; } diff --git a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php index c343981d0a9..b9047a9563c 100644 --- a/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php +++ b/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php @@ -86,7 +86,7 @@ public function __construct(Connection $conn) $this->federationName = $params['sharding']['federationName']; $this->distributionKey = $params['sharding']['distributionKey']; $this->distributionType = $params['sharding']['distributionType']; - $this->filteringEnabled = (isset($params['sharding']['filteringEnabled'])) ? (bool)$params['sharding']['filteringEnabled'] : false; + $this->filteringEnabled = (isset($params['sharding']['filteringEnabled'])) ? (bool) $params['sharding']['filteringEnabled'] : false; } /** @@ -128,7 +128,7 @@ public function getDistributionType() */ public function setFilteringEnabled($flag) { - $this->filteringEnabled = (bool)$flag; + $this->filteringEnabled = (bool) $flag; } /** @@ -191,6 +191,7 @@ public function getShards() FROM sys.federation_member_distributions d INNER JOIN sys.federations f ON f.federation_id = d.federation_id WHERE f.name = " . $this->conn->quote($this->federationName); + return $this->conn->fetchAll($sql); } diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php index 29f17ce79a9..4d76ca92b7a 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php @@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $conn = $this->getHelper('db')->getConnection(); - if (($fileNames = $input->getArgument('file')) !== null) { + if (($fileNames = $input->getArgument('file')) !== null) { foreach ((array) $fileNames as $fileName) { $filePath = realpath($fileName); diff --git a/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php b/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php index 44620578f7e..f7acd0a86ee 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php +++ b/lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php @@ -118,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /* @var $conn \Doctrine\DBAL\Connection */ $conn = $this->getHelper('db')->getConnection(); - $keywordLists = (array)$input->getOption('list'); + $keywordLists = (array) $input->getOption('list'); if ( ! $keywordLists) { $keywordLists = array( 'mysql', diff --git a/lib/Doctrine/DBAL/Types/DateTimeTzType.php b/lib/Doctrine/DBAL/Types/DateTimeTzType.php index 7303ff01ca2..2a9c6fa7b74 100644 --- a/lib/Doctrine/DBAL/Types/DateTimeTzType.php +++ b/lib/Doctrine/DBAL/Types/DateTimeTzType.php @@ -37,12 +37,12 @@ * the offset and re-created from persistence with only the offset, not the original timezone * attached. * - * @link www.doctrine-project.org - * @since 1.0 - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 1.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ class DateTimeTzType extends Type { diff --git a/lib/Doctrine/DBAL/Types/VarDateTimeType.php b/lib/Doctrine/DBAL/Types/VarDateTimeType.php index 52bd56b4bcb..5cf35f79583 100644 --- a/lib/Doctrine/DBAL/Types/VarDateTimeType.php +++ b/lib/Doctrine/DBAL/Types/VarDateTimeType.php @@ -50,6 +50,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) if ( ! $val) { throw ConversionException::conversionFailed($value, $this->getName()); } + return $val; } }