Skip to content

Commit

Permalink
Merge pull request #747 from acrobat/schema-phpcs-fixes
Browse files Browse the repository at this point in the history
minor phpdoc fixes in the schema files
  • Loading branch information
deeky666 committed Dec 24, 2014
2 parents b477523 + ba4561f commit b55fece
Show file tree
Hide file tree
Showing 32 changed files with 75 additions and 53 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -36,6 +36,7 @@ public function quote($value, $type=\PDO::PARAM_STR)
return 'false';
}
}

return parent::quote($value, $type);
}
}
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function prepare($sql)
if ( ! $stmt) {
throw new DB2Exception(db2_stmt_errormsg());
}

return new DB2Statement($stmt);
}

Expand All @@ -90,6 +91,7 @@ public function query()
$sql = $args[0];
$stmt = $this->prepare($sql);
$stmt->execute();

return $stmt;
}

Expand All @@ -113,6 +115,7 @@ public function exec($statement)
{
$stmt = $this->prepare($statement);
$stmt->execute();

return $stmt->rowCount();
}

Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function query()
$sql = $args[0];
$stmt = $this->prepare($sql);
$stmt->execute();

return $stmt;
}

Expand Down Expand Up @@ -172,6 +173,7 @@ public function lastInsertId($name = null)
public function beginTransaction()
{
$this->_conn->query('START TRANSACTION');

return true;
}

Expand Down
7 changes: 5 additions & 2 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -228,6 +228,7 @@ private function _fetch()
foreach ($this->_rowBindedValues as $v) {
$values[] = $v;
}

return $values;
}

Expand Down Expand Up @@ -260,6 +261,7 @@ public function fetch($fetchMode = null)
case PDO::FETCH_BOTH:
$ret = array_combine($this->_columnNames, $values);
$ret += $values;

return $ret;

default:
Expand Down Expand Up @@ -335,6 +337,7 @@ public function rowCount()
if (false === $this->_columnNames) {
return $this->_stmt->affected_rows;
}

return $this->_stmt->num_rows;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Id/TableGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ public function createPositionalParameter($value, $type = \PDO::PARAM_STR)
{
$this->boundCounter++;
$this->setParameter($this->boundCounter, $value, $type);

return "?";
}

Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Schema/AbstractAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -180,6 +180,7 @@ public function getName()
if ($this->_namespace) {
return $this->_namespace . "." . $this->_name;
}

return $this->_name;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}
Expand Down Expand Up @@ -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);
})
);
Expand Down Expand Up @@ -952,6 +953,7 @@ protected function _getPortableUserDefinition($user)

/**
* @param array $views
*
* @return array
*/
protected function _getPortableViewsList($views)
Expand Down
18 changes: 10 additions & 8 deletions lib/Doctrine/DBAL/Schema/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down Expand Up @@ -134,6 +134,7 @@ public function setOptions(array $options)
public function setType(Type $type)
{
$this->_type = $type;

return $this;
}

Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -180,7 +181,7 @@ public function setScale($scale)
$scale = 0;
}

$this->_scale = (int)$scale;
$this->_scale = (int) $scale;

return $this;
}
Expand All @@ -192,7 +193,7 @@ public function setScale($scale)
*/
public function setUnsigned($unsigned)
{
$this->_unsigned = (bool)$unsigned;
$this->_unsigned = (bool) $unsigned;

return $this;
}
Expand All @@ -204,7 +205,7 @@ public function setUnsigned($unsigned)
*/
public function setFixed($fixed)
{
$this->_fixed = (bool)$fixed;
$this->_fixed = (bool) $fixed;

return $this;
}
Expand All @@ -216,7 +217,7 @@ public function setFixed($fixed)
*/
public function setNotnull($notnull)
{
$this->_notnull = (bool)$notnull;
$this->_notnull = (bool) $notnull;

return $this;
}
Expand Down Expand Up @@ -386,6 +387,7 @@ public function getAutoincrement()
public function setAutoincrement($flag)
{
$this->_autoincrement = $flag;

return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
18 changes: 9 additions & 9 deletions lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'],
Expand All @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public function getForeignTableName()
public function getUnqualifiedForeignTableName()
{
$parts = explode(".", $this->_foreignTableName->getName());

return strtolower(end($parts));
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Schema/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Schema/SchemaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function hasExplicitForeignKeyIndexes()
*/
public function setExplicitForeignKeyIndexes($flag)
{
$this->hasExplicitForeignKeyIndexes = (bool)$flag;
$this->hasExplicitForeignKeyIndexes = (bool) $flag;
}

/**
Expand All @@ -73,7 +73,7 @@ public function setExplicitForeignKeyIndexes($flag)
*/
public function setMaxIdentifierLength($length)
{
$this->maxIdentifierLength = (int)$length;
$this->maxIdentifierLength = (int) $length;
}

/**
Expand Down
Loading

0 comments on commit b55fece

Please sign in to comment.