Unverified Commit b90d6324 authored by Luís Cobucci's avatar Luís Cobucci Committed by GitHub

Merge pull request #3432 from morozov/phpstan-0.11

Updated PHPStan to v0.11
parents 07316080 ec227058
This diff is collapsed.
......@@ -1227,9 +1227,7 @@ class Connection implements DriverConnection
}
/**
* Starts a transaction by suspending auto-commit mode.
*
* @return void
* {@inheritDoc}
*/
public function beginTransaction()
{
......@@ -1256,12 +1254,12 @@ class Connection implements DriverConnection
$logger->stopQuery();
}
}
return true;
}
/**
* Commits the current transaction.
*
* @return void
* {@inheritDoc}
*
* @throws ConnectionException If the commit failed due to no active transaction or
* because the transaction was marked for rollback only.
......@@ -1300,10 +1298,12 @@ class Connection implements DriverConnection
--$this->transactionNestingLevel;
if ($this->autoCommit !== false || $this->transactionNestingLevel !== 0) {
return;
return true;
}
$this->beginTransaction();
return true;
}
/**
......
......@@ -232,7 +232,7 @@ class MasterSlaveConnection extends Connection
{
$this->connect('master');
parent::beginTransaction();
return parent::beginTransaction();
}
/**
......@@ -242,7 +242,7 @@ class MasterSlaveConnection extends Connection
{
$this->connect('master');
parent::commit();
return parent::commit();
}
/**
......
......@@ -167,7 +167,7 @@ class DB2Statement implements IteratorAggregate, Statement
public function columnCount()
{
if (! $this->stmt) {
return false;
return 0;
}
return db2_num_fields($this->stmt);
......
......@@ -11,13 +11,14 @@ use IteratorAggregate;
use mysqli;
use mysqli_stmt;
use PDO;
use stdClass;
use function array_combine;
use function array_fill;
use function assert;
use function count;
use function feof;
use function fread;
use function get_resource_type;
use function is_array;
use function is_resource;
use function sprintf;
use function str_repeat;
......@@ -327,28 +328,23 @@ class MysqliStatement implements IteratorAggregate, Statement
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
}
switch ($fetchMode) {
case FetchMode::NUMERIC:
if ($fetchMode === FetchMode::NUMERIC) {
return $values;
}
assert(is_array($this->_columnNames));
$assoc = array_combine($this->_columnNames, $values);
assert(is_array($assoc));
switch ($fetchMode) {
case FetchMode::ASSOCIATIVE:
return array_combine($this->_columnNames, $values);
return $assoc;
case FetchMode::MIXED:
$ret = array_combine($this->_columnNames, $values);
$ret += $values;
return $ret;
return $assoc + $values;
case FetchMode::STANDARD_OBJECT:
$assoc = array_combine($this->_columnNames, $values);
$ret = new stdClass();
foreach ($assoc as $column => $value) {
$ret->$column = $value;
}
return $ret;
return (object) $assoc;
default:
throw new MysqliException(sprintf("Unknown fetch type '%s'", $fetchMode));
......
......@@ -356,7 +356,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* Generate a PRIMARY KEY definition if no autoincrement value is used
*
* @param string[] $columns
* @param mixed[][] $columns
* @param mixed[] $options
*/
private function getNonAutoincrementPrimaryKeyDefinition(array $columns, array $options) : string
......@@ -368,7 +368,7 @@ class SqlitePlatform extends AbstractPlatform
$keyColumns = array_unique(array_values($options['primary']));
foreach ($keyColumns as $keyColumn) {
if (isset($columns[$keyColumn]['autoincrement']) && ! empty($columns[$keyColumn]['autoincrement'])) {
if (! empty($columns[$keyColumn]['autoincrement'])) {
return '';
}
}
......
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