Skip to content

Commit

Permalink
Fixed code style
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Jan 29, 2018
1 parent 7dadba4 commit 0e99c34
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Cache/ArrayStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function getIterator()
*/
public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
{
if ( ! isset($this->data[$this->num])) {
if (! isset($this->data[$this->num])) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ public function fetch($fetchMode = null, $cursorOrientation = \PDO::FETCH_ORI_NE

$fetchMode = $fetchMode ?: $this->defaultFetchMode;

if ($fetchMode == FetchMode::ASSOCIATIVE) {
if ($fetchMode === FetchMode::ASSOCIATIVE) {
return $row;
}

if ($fetchMode == FetchMode::NUMERIC) {
if ($fetchMode === FetchMode::NUMERIC) {
return array_values($row);
}

if ($fetchMode == FetchMode::MIXED) {
if ($fetchMode === FetchMode::MIXED) {
return array_merge($row, array_values($row));
}

if ($fetchMode == FetchMode::COLUMN) {
if ($fetchMode === FetchMode::COLUMN) {
return reset($row);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ class Connection implements DriverConnection
*
* @var int
*/
const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;
public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;

/**
* Represents an array of strings to be expanded by Doctrine SQL parsing.
*
* @var int
*/
const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;
public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;

/**
* Offset by which PARAM_* constants are detected as arrays of the param type.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function quote($input, $type = ParameterType::STRING)
{
$input = db2_escape_string($input);

if ($type == ParameterType::INTEGER) {
if ($type === ParameterType::INTEGER) {
return $input;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
static private $_typeMap = [
ParameterType::INTEGER => DB2_LONG,
ParameterType::STRING => DB2_CHAR,
ParameterType::STRING => DB2_CHAR,
];

/**
Expand Down
12 changes: 7 additions & 5 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class MysqliStatement implements \IteratorAggregate, Statement
* @var array
*/
protected static $_paramTypeMap = [
ParameterType::STRING => 's',
ParameterType::BOOLEAN => 'i',
ParameterType::NULL => 's',
ParameterType::INTEGER => 'i',
ParameterType::LARGE_OBJECT => 's' // TODO Support LOB bigger then max package size.
ParameterType::STRING => 's',
ParameterType::BOOLEAN => 'i',
ParameterType::NULL => 's',
ParameterType::INTEGER => 'i',

// TODO Support LOB bigger then max package size
ParameterType::LARGE_OBJECT => 's',
];

/**
Expand Down
14 changes: 7 additions & 7 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class OCI8Statement implements IteratorAggregate, Statement
* @var array
*/
protected static $fetchModeMap = [
FetchMode::MIXED => OCI_BOTH,
FetchMode::MIXED => OCI_BOTH,
FetchMode::ASSOCIATIVE => OCI_ASSOC,
FetchMode::NUMERIC => OCI_NUM,
FetchMode::COLUMN => OCI_NUM,
FetchMode::NUMERIC => OCI_NUM,
FetchMode::COLUMN => OCI_NUM,
];

/**
Expand Down Expand Up @@ -267,7 +267,7 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l
{
$column = $this->_paramMap[$column] ?? $column;

if ($type == ParameterType::LARGE_OBJECT) {
if ($type === ParameterType::LARGE_OBJECT) {
$lob = oci_new_descriptor($this->_dbh, OCI_D_LOB);
$lob->writeTemporary($variable, OCI_TEMP_BLOB);

Expand Down Expand Up @@ -415,7 +415,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n

$result = [];

if ($fetchMode == FetchMode::STANDARD_OBJECT) {
if ($fetchMode === FetchMode::STANDARD_OBJECT) {
while ($row = $this->fetch($fetchMode)) {
$result[] = $row;
}
Expand All @@ -434,7 +434,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n
} else {
$fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;

if ($fetchMode == FetchMode::COLUMN) {
if ($fetchMode === FetchMode::COLUMN) {
$fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
}

Expand All @@ -447,7 +447,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n
oci_fetch_all($this->_sth, $result, 0, -1,
self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);

if ($fetchMode == FetchMode::COLUMN) {
if ($fetchMode === FetchMode::COLUMN) {
$result = $result[0];
}
}
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/DBAL/Driver/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,10 @@ public function fetchColumn($columnIndex = 0)
* Converts DBAL parameter type to PDO parameter type
*
* @param int $type Parameter type
* @return int
*/
private function convertParamType(int $type) : int
{
if ( ! isset(self::PARAM_TYPE_MAP[$type])) {
if (! isset(self::PARAM_TYPE_MAP[$type])) {
throw new \InvalidArgumentException('Invalid parameter type: ' . $type);
}

Expand All @@ -224,15 +223,14 @@ private function convertParamType(int $type) : int
* Converts DBAL fetch mode to PDO fetch mode
*
* @param int|null $fetchMode Fetch mode
* @return int|null
*/
private function convertFetchMode(?int $fetchMode) : ?int
{
if ($fetchMode === null) {
return null;
}

if ( ! isset(self::FETCH_MODE_MAP[$fetchMode])) {
if (! isset(self::FETCH_MODE_MAP[$fetchMode])) {
throw new \InvalidArgumentException('Invalid fetch mode: ' . $fetchMode);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class SQLSrvStatement implements IteratorAggregate, Statement
* @var array
*/
private static $fetchMap = [
FetchMode::MIXED => SQLSRV_FETCH_BOTH,
FetchMode::MIXED => SQLSRV_FETCH_BOTH,
FetchMode::ASSOCIATIVE => SQLSRV_FETCH_ASSOC,
FetchMode::NUMERIC => SQLSRV_FETCH_NUMERIC,
FetchMode::NUMERIC => SQLSRV_FETCH_NUMERIC,
];

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/DriverManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function testDatabaseUrl($url, $expected)
);

if (isset($options['pdo'])) {
if ( ! extension_loaded('pdo')) {
if (! extension_loaded('pdo')) {
$this->markTestSkipped('PDO is not installed');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/TestUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private static function getSpecifiedConnectionParams() {

private static function getFallbackConnectionParams()
{
if ( ! extension_loaded('pdo_sqlite')) {
if (! extension_loaded('pdo_sqlite')) {
Assert::markTestSkipped('PDO SQLite extension is not loaded');
}

Expand Down

0 comments on commit 0e99c34

Please sign in to comment.