Fixed code style

parent 7dadba43
......@@ -100,7 +100,7 @@ class ArrayStatement implements \IteratorAggregate, ResultStatement
*/
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;
}
......
......@@ -160,19 +160,19 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
$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);
}
......
......@@ -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.
......
......@@ -103,7 +103,7 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
{
$input = db2_escape_string($input);
if ($type == ParameterType::INTEGER) {
if ($type === ParameterType::INTEGER) {
return $input;
}
......
......@@ -65,7 +65,7 @@ class DB2Statement implements \IteratorAggregate, Statement
*/
static private $_typeMap = [
ParameterType::INTEGER => DB2_LONG,
ParameterType::STRING => DB2_CHAR,
ParameterType::STRING => DB2_CHAR,
];
/**
......
......@@ -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',
];
/**
......
......@@ -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,
];
/**
......@@ -267,7 +267,7 @@ class OCI8Statement implements IteratorAggregate, Statement
{
$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);
......@@ -415,7 +415,7 @@ class OCI8Statement implements IteratorAggregate, Statement
$result = [];
if ($fetchMode == FetchMode::STANDARD_OBJECT) {
if ($fetchMode === FetchMode::STANDARD_OBJECT) {
while ($row = $this->fetch($fetchMode)) {
$result[] = $row;
}
......@@ -434,7 +434,7 @@ class OCI8Statement implements IteratorAggregate, Statement
} else {
$fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;
if ($fetchMode == FetchMode::COLUMN) {
if ($fetchMode === FetchMode::COLUMN) {
$fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
}
......@@ -447,7 +447,7 @@ class OCI8Statement implements IteratorAggregate, Statement
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];
}
}
......
......@@ -209,11 +209,10 @@ class PDOStatement extends \PDOStatement implements Statement
* 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);
}
......@@ -224,7 +223,6 @@ class PDOStatement extends \PDOStatement implements Statement
* Converts DBAL fetch mode to PDO fetch mode
*
* @param int|null $fetchMode Fetch mode
* @return int|null
*/
private function convertFetchMode(?int $fetchMode) : ?int
{
......@@ -232,7 +230,7 @@ class PDOStatement extends \PDOStatement implements Statement
return null;
}
if ( ! isset(self::FETCH_MODE_MAP[$fetchMode])) {
if (! isset(self::FETCH_MODE_MAP[$fetchMode])) {
throw new \InvalidArgumentException('Invalid fetch mode: ' . $fetchMode);
}
......
......@@ -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,
];
/**
......
......@@ -139,7 +139,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
if (isset($options['pdo'])) {
if ( ! extension_loaded('pdo')) {
if (! extension_loaded('pdo')) {
$this->markTestSkipped('PDO is not installed');
}
......
......@@ -113,7 +113,7 @@ class TestUtil
private static function getFallbackConnectionParams()
{
if ( ! extension_loaded('pdo_sqlite')) {
if (! extension_loaded('pdo_sqlite')) {
Assert::markTestSkipped('PDO SQLite extension is not loaded');
}
......
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