Manual coding style fixes

parent 9da1ea3e
...@@ -15,7 +15,7 @@ use function reset; ...@@ -15,7 +15,7 @@ use function reset;
class ArrayStatement implements IteratorAggregate, ResultStatement class ArrayStatement implements IteratorAggregate, ResultStatement
{ {
/** @var array */ /** @var mixed[] */
private $data; private $data;
/** @var int */ /** @var int */
...@@ -28,7 +28,7 @@ class ArrayStatement implements IteratorAggregate, ResultStatement ...@@ -28,7 +28,7 @@ class ArrayStatement implements IteratorAggregate, ResultStatement
private $defaultFetchMode = FetchMode::MIXED; private $defaultFetchMode = FetchMode::MIXED;
/** /**
* @param array $data * @param mixed[] $data
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {
......
...@@ -68,11 +68,11 @@ class QueryCacheProfile ...@@ -68,11 +68,11 @@ class QueryCacheProfile
* Generates the real cache key from query, params, types and connection parameters. * Generates the real cache key from query, params, types and connection parameters.
* *
* @param string $query * @param string $query
* @param array $params * @param mixed[] $params
* @param array $types * @param int[]|string[] $types
* @param array $connectionParams * @param mixed[] $connectionParams
* *
* @return array * @return string[]
*/ */
public function generateCacheKeys($query, $params, $types, array $connectionParams = []) public function generateCacheKeys($query, $params, $types, array $connectionParams = [])
{ {
......
...@@ -51,7 +51,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -51,7 +51,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
*/ */
private $emptied = false; private $emptied = false;
/** @var array */ /** @var mixed[] */
private $data; private $data;
/** @var int */ /** @var int */
...@@ -78,7 +78,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -78,7 +78,7 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
{ {
$this->statement->closeCursor(); $this->statement->closeCursor();
if (! $this->emptied || $this->data === null) { if (! $this->emptied || $this->data === null) {
return; return true;
} }
$data = $this->resultCache->fetch($this->cacheKey); $data = $this->resultCache->fetch($this->cacheKey);
...@@ -89,6 +89,8 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -89,6 +89,8 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
$this->resultCache->save($this->cacheKey, $data, $this->lifetime); $this->resultCache->save($this->cacheKey, $data, $this->lifetime);
unset($this->data); unset($this->data);
return true;
} }
/** /**
......
...@@ -17,7 +17,7 @@ class Configuration ...@@ -17,7 +17,7 @@ class Configuration
* The attributes that are contained in the configuration. * The attributes that are contained in the configuration.
* Values are default values. * Values are default values.
* *
* @var array * @var mixed[]
*/ */
protected $_attributes = []; protected $_attributes = [];
......
This diff is collapsed.
...@@ -85,7 +85,7 @@ class MasterSlaveConnection extends Connection ...@@ -85,7 +85,7 @@ class MasterSlaveConnection extends Connection
/** /**
* Creates Master Slave Connection. * Creates Master Slave Connection.
* *
* @param array $params * @param mixed[] $params
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
...@@ -196,7 +196,7 @@ class MasterSlaveConnection extends Connection ...@@ -196,7 +196,7 @@ class MasterSlaveConnection extends Connection
/** /**
* @param string $connectionName * @param string $connectionName
* @param array $params * @param mixed[] $params
* *
* @return mixed * @return mixed
*/ */
......
...@@ -29,7 +29,7 @@ class DBALException extends Exception ...@@ -29,7 +29,7 @@ class DBALException extends Exception
*/ */
public static function notSupported($method) public static function notSupported($method)
{ {
return new self("Operation '$method' is not supported by platform."); return new self(sprintf("Operation '%s' is not supported by platform.", $method));
} }
public static function invalidPlatformSpecified() : self public static function invalidPlatformSpecified() : self
...@@ -118,7 +118,7 @@ class DBALException extends Exception ...@@ -118,7 +118,7 @@ class DBALException extends Exception
/** /**
* @param string $unknownDriverName * @param string $unknownDriverName
* @param array $knownDrivers * @param string[] $knownDrivers
* *
* @return \Doctrine\DBAL\DBALException * @return \Doctrine\DBAL\DBALException
*/ */
...@@ -131,7 +131,7 @@ class DBALException extends Exception ...@@ -131,7 +131,7 @@ class DBALException extends Exception
/** /**
* @param Exception $driverEx * @param Exception $driverEx
* @param string $sql * @param string $sql
* @param array $params * @param mixed[] $params
* *
* @return \Doctrine\DBAL\DBALException * @return \Doctrine\DBAL\DBALException
*/ */
...@@ -177,7 +177,7 @@ class DBALException extends Exception ...@@ -177,7 +177,7 @@ class DBALException extends Exception
* Returns a human-readable representation of an array of parameters. * Returns a human-readable representation of an array of parameters.
* This properly handles binary data by returning a hex representation. * This properly handles binary data by returning a hex representation.
* *
* @param array $params * @param mixed[] $params
* *
* @return string * @return string
*/ */
......
...@@ -14,10 +14,10 @@ interface Driver ...@@ -14,10 +14,10 @@ interface Driver
/** /**
* Attempts to create a connection with the database. * Attempts to create a connection with the database.
* *
* @param array $params All connection parameters passed by the user. * @param mixed[] $params All connection parameters passed by the user.
* @param string|null $username The username to use when connecting. * @param string|null $username The username to use when connecting.
* @param string|null $password The password to use when connecting. * @param string|null $password The password to use when connecting.
* @param array $driverOptions The driver options to use when connecting. * @param mixed[] $driverOptions The driver options to use when connecting.
* *
* @return \Doctrine\DBAL\Driver\Connection The database connection. * @return \Doctrine\DBAL\Driver\Connection The database connection.
*/ */
......
...@@ -88,7 +88,7 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver ...@@ -88,7 +88,7 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
/** /**
* Returns an appropriate Easy Connect String for the given parameters. * Returns an appropriate Easy Connect String for the given parameters.
* *
* @param array $params The connection parameters to return the Easy Connect STring for. * @param mixed[] $params The connection parameters to return the Easy Connect String for.
* *
* @return string * @return string
*/ */
......
...@@ -76,7 +76,6 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr ...@@ -76,7 +76,6 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getSchemaManager(Connection $conn) public function getSchemaManager(Connection $conn)
{ {
return new SQLServerSchemaManager($conn); return new SQLServerSchemaManager($conn);
......
...@@ -87,7 +87,7 @@ interface Connection ...@@ -87,7 +87,7 @@ interface Connection
/** /**
* Returns extended error information associated with the last operation on the database handle. * Returns extended error information associated with the last operation on the database handle.
* *
* @return array * @return mixed[]
*/ */
public function errorInfo(); public function errorInfo();
} }
...@@ -30,10 +30,10 @@ class DB2Connection implements Connection, ServerInfoAwareConnection ...@@ -30,10 +30,10 @@ class DB2Connection implements Connection, ServerInfoAwareConnection
private $_conn = null; private $_conn = null;
/** /**
* @param array $params * @param mixed[] $params
* @param string $username * @param string $username
* @param string $password * @param string $password
* @param array $driverOptions * @param mixed[] $driverOptions
* *
* @throws DB2Exception * @throws DB2Exception
*/ */
......
...@@ -42,7 +42,7 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -42,7 +42,7 @@ class DB2Statement implements IteratorAggregate, Statement
/** @var resource */ /** @var resource */
private $_stmt; private $_stmt;
/** @var array */ /** @var mixed[] */
private $_bindParam = []; private $_bindParam = [];
/** @var string Name of the default class to instantiate when fetching class instances. */ /** @var string Name of the default class to instantiate when fetching class instances. */
...@@ -64,7 +64,7 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -64,7 +64,7 @@ class DB2Statement implements IteratorAggregate, Statement
/** /**
* DB2_BINARY, DB2_CHAR, DB2_DOUBLE, or DB2_LONG * DB2_BINARY, DB2_CHAR, DB2_DOUBLE, or DB2_LONG
* *
* @var array * @var int[]
*/ */
static private $_typeMap = [ static private $_typeMap = [
ParameterType::INTEGER => DB2_LONG, ParameterType::INTEGER => DB2_LONG,
...@@ -313,7 +313,7 @@ class DB2Statement implements IteratorAggregate, Statement ...@@ -313,7 +313,7 @@ class DB2Statement implements IteratorAggregate, Statement
* *
* @param stdClass $sourceObject Object to cast from. * @param stdClass $sourceObject Object to cast from.
* @param string|object $destinationClass Name of the class or class instance to cast to. * @param string|object $destinationClass Name of the class or class instance to cast to.
* @param array $ctorArgs Arguments to use for constructing the destination class instance. * @param mixed[] $ctorArgs Arguments to use for constructing the destination class instance.
* *
* @return object * @return object
* *
......
...@@ -38,10 +38,10 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -38,10 +38,10 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
private $_conn; private $_conn;
/** /**
* @param array $params * @param mixed[] $params
* @param string $username * @param string $username
* @param string $password * @param string $password
* @param array $driverOptions * @param mixed[] $driverOptions
* *
* @throws MysqliException * @throws MysqliException
*/ */
...@@ -217,7 +217,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -217,7 +217,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
/** /**
* Apply the driver options to the connection. * Apply the driver options to the connection.
* *
* @param array $driverOptions * @param mixed[] $driverOptions
* *
* @throws MysqliException When one of of the options is not supported. * @throws MysqliException When one of of the options is not supported.
* @throws MysqliException When applying doesn't work - e.g. due to incorrect value. * @throws MysqliException When applying doesn't work - e.g. due to incorrect value.
...@@ -277,7 +277,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -277,7 +277,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
/** /**
* Establish a secure connection * Establish a secure connection
* *
* @param array $params * @param mixed[] $params
* *
* @throws MysqliException * @throws MysqliException
*/ */
......
...@@ -19,11 +19,12 @@ use function feof; ...@@ -19,11 +19,12 @@ use function feof;
use function fread; use function fread;
use function get_resource_type; use function get_resource_type;
use function is_resource; use function is_resource;
use function sprintf;
use function str_repeat; use function str_repeat;
class MysqliStatement implements IteratorAggregate, Statement class MysqliStatement implements IteratorAggregate, Statement
{ {
/** @var array */ /** @var string[] */
protected static $_paramTypeMap = [ protected static $_paramTypeMap = [
ParameterType::STRING => 's', ParameterType::STRING => 's',
ParameterType::BINARY => 's', ParameterType::BINARY => 's',
...@@ -39,13 +40,13 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -39,13 +40,13 @@ class MysqliStatement implements IteratorAggregate, Statement
/** @var mysqli_stmt */ /** @var mysqli_stmt */
protected $_stmt; protected $_stmt;
/** @var bool|array|null */ /** @var string[]|bool|null */
protected $_columnNames; protected $_columnNames;
/** @var array|null */ /** @var mixed[]|null */
protected $_rowBindedValues; protected $_rowBindedValues;
/** @var array */ /** @var mixed[] */
protected $_bindedValues; protected $_bindedValues;
/** @var string */ /** @var string */
...@@ -54,7 +55,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -54,7 +55,7 @@ class MysqliStatement implements IteratorAggregate, Statement
/** /**
* Contains ref values for bindValue(). * Contains ref values for bindValue().
* *
* @var array * @var mixed[]
*/ */
protected $_values = []; protected $_values = [];
...@@ -99,7 +100,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -99,7 +100,7 @@ class MysqliStatement implements IteratorAggregate, Statement
$type = 's'; $type = 's';
} else { } else {
if (! isset(self::$_paramTypeMap[$type])) { if (! isset(self::$_paramTypeMap[$type])) {
throw new MysqliException("Unknown type: '{$type}'"); throw new MysqliException(sprintf("Unknown type: '%s'", $type));
} }
$type = self::$_paramTypeMap[$type]; $type = self::$_paramTypeMap[$type];
...@@ -120,7 +121,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -120,7 +121,7 @@ class MysqliStatement implements IteratorAggregate, Statement
$type = 's'; $type = 's';
} else { } else {
if (! isset(self::$_paramTypeMap[$type])) { if (! isset(self::$_paramTypeMap[$type])) {
throw new MysqliException("Unknown type: '{$type}'"); throw new MysqliException(sprintf("Unknown type: '%s'", $type));
} }
$type = self::$_paramTypeMap[$type]; $type = self::$_paramTypeMap[$type];
...@@ -265,7 +266,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -265,7 +266,7 @@ class MysqliStatement implements IteratorAggregate, Statement
/** /**
* Binds a array of values to bound parameters. * Binds a array of values to bound parameters.
* *
* @param array $values * @param mixed[] $values
* *
* @return bool * @return bool
*/ */
...@@ -350,7 +351,7 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -350,7 +351,7 @@ class MysqliStatement implements IteratorAggregate, Statement
return $ret; return $ret;
default: default:
throw new MysqliException("Unknown fetch type '{$fetchMode}'"); throw new MysqliException(sprintf("Unknown fetch type '%s'", $fetchMode));
} }
} }
......
...@@ -33,7 +33,7 @@ class Driver extends AbstractOracleDriver ...@@ -33,7 +33,7 @@ class Driver extends AbstractOracleDriver
/** /**
* Constructs the Oracle DSN. * Constructs the Oracle DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
......
...@@ -66,7 +66,7 @@ class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -66,7 +66,7 @@ class OCI8Connection implements Connection, ServerInfoAwareConnection
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws UnexpectedValueException if the version string returned by the database server * @throws UnexpectedValueException If the version string returned by the database server
* does not contain a parsable version number. * does not contain a parsable version number.
*/ */
public function getServerVersion() public function getServerVersion()
......
...@@ -7,7 +7,7 @@ use Doctrine\DBAL\Driver\AbstractDriverException; ...@@ -7,7 +7,7 @@ use Doctrine\DBAL\Driver\AbstractDriverException;
class OCI8Exception extends AbstractDriverException class OCI8Exception extends AbstractDriverException
{ {
/** /**
* @param array $error * @param mixed[] $error
* *
* @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception * @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception
*/ */
......
...@@ -59,7 +59,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -59,7 +59,7 @@ class OCI8Statement implements IteratorAggregate, Statement
/** @var string */ /** @var string */
protected static $_PARAM = ':param'; protected static $_PARAM = ':param';
/** @var array */ /** @var int[] */
protected static $fetchModeMap = [ protected static $fetchModeMap = [
FetchMode::MIXED => OCI_BOTH, FetchMode::MIXED => OCI_BOTH,
FetchMode::ASSOCIATIVE => OCI_ASSOC, FetchMode::ASSOCIATIVE => OCI_ASSOC,
...@@ -70,7 +70,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -70,7 +70,7 @@ class OCI8Statement implements IteratorAggregate, Statement
/** @var int */ /** @var int */
protected $_defaultFetchMode = FetchMode::MIXED; protected $_defaultFetchMode = FetchMode::MIXED;
/** @var array */ /** @var string[] */
protected $_paramMap = []; protected $_paramMap = [];
/** /**
...@@ -78,7 +78,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -78,7 +78,7 @@ class OCI8Statement implements IteratorAggregate, Statement
* *
* This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected. * This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected.
* *
* @var array * @var mixed[]
*/ */
private $boundValues = []; private $boundValues = [];
...@@ -118,7 +118,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -118,7 +118,7 @@ class OCI8Statement implements IteratorAggregate, Statement
* *
* @param string $statement The SQL statement to convert. * @param string $statement The SQL statement to convert.
* *
* @return array [0] => the statement value (string), [1] => the paramMap value (array). * @return mixed[] [0] => the statement value (string), [1] => the paramMap value (array).
* *
* @throws OCI8Exception * @throws OCI8Exception
* *
......
...@@ -17,9 +17,9 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection ...@@ -17,9 +17,9 @@ class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
* @param string $dsn * @param string $dsn
* @param string|null $user * @param string|null $user
* @param string|null $password * @param string|null $password
* @param array|null $options * @param mixed[]|null $options
* *
* @throws PDOException in case of an error. * @throws PDOException In case of an error.
*/ */
public function __construct($dsn, $user = null, $password = null, ?array $options = null) public function __construct($dsn, $user = null, $password = null, ?array $options = null)
{ {
......
...@@ -28,7 +28,7 @@ class Driver extends AbstractDB2Driver ...@@ -28,7 +28,7 @@ class Driver extends AbstractDB2Driver
/** /**
* Constructs the IBM PDO DSN. * Constructs the IBM PDO DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
......
...@@ -34,7 +34,7 @@ class Driver extends AbstractMySQLDriver ...@@ -34,7 +34,7 @@ class Driver extends AbstractMySQLDriver
/** /**
* Constructs the MySql PDO DSN. * Constructs the MySql PDO DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
......
...@@ -37,7 +37,7 @@ class Driver extends AbstractOracleDriver ...@@ -37,7 +37,7 @@ class Driver extends AbstractOracleDriver
/** /**
* Constructs the Oracle PDO DSN. * Constructs the Oracle PDO DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
......
...@@ -52,7 +52,7 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -52,7 +52,7 @@ class Driver extends AbstractPostgreSQLDriver
/** /**
* Constructs the Postgres PDO DSN. * Constructs the Postgres PDO DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
...@@ -76,7 +76,7 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -76,7 +76,7 @@ class Driver extends AbstractPostgreSQLDriver
// Used for temporary connections to allow operations like dropping the database currently connected to. // Used for temporary connections to allow operations like dropping the database currently connected to.
// Connecting without an explicit database does not work, therefore "postgres" database is used // Connecting without an explicit database does not work, therefore "postgres" database is used
// as it is mostly present in every server setup. // as it is mostly present in every server setup.
$dsn .= 'dbname=postgres' . ';'; $dsn .= 'dbname=postgres;';
} }
if (isset($params['sslmode'])) { if (isset($params['sslmode'])) {
......
...@@ -13,7 +13,7 @@ use function array_merge; ...@@ -13,7 +13,7 @@ use function array_merge;
*/ */
class Driver extends AbstractSQLiteDriver class Driver extends AbstractSQLiteDriver
{ {
/** @var array */ /** @var mixed[] */
protected $_userDefinedFunctions = [ protected $_userDefinedFunctions = [
'sqrt' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'], 'numArgs' => 1], 'sqrt' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'], 'numArgs' => 1],
'mod' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'], 'numArgs' => 2], 'mod' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'], 'numArgs' => 2],
...@@ -54,7 +54,7 @@ class Driver extends AbstractSQLiteDriver ...@@ -54,7 +54,7 @@ class Driver extends AbstractSQLiteDriver
/** /**
* Constructs the Sqlite PDO DSN. * Constructs the Sqlite PDO DSN.
* *
* @param array $params * @param mixed[] $params
* *
* @return string The DSN. * @return string The DSN.
*/ */
......
...@@ -29,7 +29,7 @@ class Driver extends AbstractSQLServerDriver ...@@ -29,7 +29,7 @@ class Driver extends AbstractSQLServerDriver
/** /**
* Constructs the Sqlsrv PDO DSN. * Constructs the Sqlsrv PDO DSN.
* *
* @param array $params * @param mixed[] $params
* @param string[] $connectionOptions * @param string[] $connectionOptions
* *
* @return string The DSN. * @return string The DSN.
...@@ -54,9 +54,7 @@ class Driver extends AbstractSQLServerDriver ...@@ -54,9 +54,7 @@ class Driver extends AbstractSQLServerDriver
$connectionOptions['MultipleActiveResultSets'] = $params['MultipleActiveResultSets'] ? 'true' : 'false'; $connectionOptions['MultipleActiveResultSets'] = $params['MultipleActiveResultSets'] ? 'true' : 'false';
} }
$dsn .= $this->getConnectionOptionsDsn($connectionOptions); return $dsn . $this->getConnectionOptionsDsn($connectionOptions);
return $dsn;
} }
/** /**
......
...@@ -78,11 +78,11 @@ interface ResultStatement extends Traversable ...@@ -78,11 +78,11 @@ interface ResultStatement extends Traversable
* to named properties in the class. * to named properties in the class.
* * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's * * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's
* columns as parameters in the call. * columns as parameters in the call.
* @param array|null $ctorArgs Controls how the next row will be returned to the caller. * @param mixed[]|null $ctorArgs Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants, * The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}. * defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* *
* @return array * @return mixed[]
*/ */
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null); public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null);
...@@ -90,10 +90,9 @@ interface ResultStatement extends Traversable ...@@ -90,10 +90,9 @@ interface ResultStatement extends Traversable
* Returns a single column from the next row of a result set or FALSE if there are no more rows. * Returns a single column from the next row of a result set or FALSE if there are no more rows.
* *
* @param int $columnIndex 0-indexed number of the column you wish to retrieve from the row. * @param int $columnIndex 0-indexed number of the column you wish to retrieve from the row.
* If no value is supplied, PDOStatement->fetchColumn() * If no value is supplied, fetches the first column.
* fetches the first column.
* *
* @return string|bool A single column in the next row of a result set, or FALSE if there are no more rows. * @return mixed|false A single column in the next row of a result set, or FALSE if there are no more rows.
*/ */
public function fetchColumn($columnIndex = 0); public function fetchColumn($columnIndex = 0);
} }
...@@ -18,7 +18,7 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -18,7 +18,7 @@ class Driver extends AbstractSQLAnywhereDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws DBALException if there was a problem establishing the connection. * @throws DBALException If there was a problem establishing the connection.
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = []) public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{ {
...@@ -59,7 +59,7 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -59,7 +59,7 @@ class Driver extends AbstractSQLAnywhereDriver
* @param string $dbname Name of the database on the server instance to connect to. * @param string $dbname Name of the database on the server instance to connect to.
* @param string $username User name to use for connection authentication. * @param string $username User name to use for connection authentication.
* @param string $password Password to use for connection authentication. * @param string $password Password to use for connection authentication.
* @param array $driverOptions Additional parameters to use for the connection. * @param mixed[] $driverOptions Additional parameters to use for the connection.
* *
* @return string * @return string
*/ */
......
...@@ -315,7 +315,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -315,7 +315,7 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
* *
* @param stdClass $sourceObject Object to cast from. * @param stdClass $sourceObject Object to cast from.
* @param string|object $destinationClass Name of the class or class instance to cast to. * @param string|object $destinationClass Name of the class or class instance to cast to.
* @param array $ctorArgs Arguments to use for constructing the destination class instance. * @param mixed[] $ctorArgs Arguments to use for constructing the destination class instance.
* *
* @return object * @return object
* *
......
...@@ -34,7 +34,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -34,7 +34,7 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
/** /**
* @param string $serverName * @param string $serverName
* @param array $connectionOptions * @param mixed[] $connectionOptions
* *
* @throws SQLSrvException * @throws SQLSrvException
*/ */
......
...@@ -63,21 +63,21 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -63,21 +63,21 @@ class SQLSrvStatement implements IteratorAggregate, Statement
/** /**
* References to the variables bound as statement parameters. * References to the variables bound as statement parameters.
* *
* @var array * @var mixed
*/ */
private $variables = []; private $variables = [];
/** /**
* Bound parameter types. * Bound parameter types.
* *
* @var array * @var int[]
*/ */
private $types = []; private $types = [];
/** /**
* Translations. * Translations.
* *
* @var array * @var int[]
*/ */
private static $fetchMap = [ private static $fetchMap = [
FetchMode::MIXED => SQLSRV_FETCH_BOTH, FetchMode::MIXED => SQLSRV_FETCH_BOTH,
...@@ -271,8 +271,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -271,8 +271,8 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$params[$column - 1] = [ $params[$column - 1] = [
&$variable, &$variable,
SQLSRV_PARAM_IN, SQLSRV_PARAM_IN,
sqlsrv_phptype_stream(SQLSRV_ENC_BINARY), SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY),
sqlsrv_sqltype_varbinary('max'), SQLSRV_SQLTYPE_VARBINARY('max'),
]; ];
break; break;
...@@ -280,7 +280,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -280,7 +280,7 @@ class SQLSrvStatement implements IteratorAggregate, Statement
$params[$column - 1] = [ $params[$column - 1] = [
&$variable, &$variable,
SQLSRV_PARAM_IN, SQLSRV_PARAM_IN,
sqlsrv_phptype_string(SQLSRV_ENC_BINARY), SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY),
]; ];
break; break;
......
...@@ -72,9 +72,7 @@ interface Statement extends ResultStatement ...@@ -72,9 +72,7 @@ interface Statement extends ResultStatement
/** /**
* Fetches extended error information associated with the last operation on the statement handle. * Fetches extended error information associated with the last operation on the statement handle.
* *
* @see Doctrine_Adapter_Interface::errorInfo() * @return mixed[] The error info array.
*
* @return array The error info array.
*/ */
public function errorInfo(); public function errorInfo();
...@@ -87,7 +85,7 @@ interface Statement extends ResultStatement ...@@ -87,7 +85,7 @@ interface Statement extends ResultStatement
* if any, of their associated parameter markers or pass an array of input-only * if any, of their associated parameter markers or pass an array of input-only
* parameter values. * parameter values.
* *
* @param array|null $params An array of values with as many elements as there are * @param mixed[]|null $params An array of values with as many elements as there are
* bound parameters in the SQL statement being executed. * bound parameters in the SQL statement being executed.
* *
* @return bool TRUE on success or FALSE on failure. * @return bool TRUE on success or FALSE on failure.
......
...@@ -28,7 +28,7 @@ final class DriverManager ...@@ -28,7 +28,7 @@ final class DriverManager
* To add your own driver use the 'driverClass' parameter to * To add your own driver use the 'driverClass' parameter to
* {@link DriverManager::getConnection()}. * {@link DriverManager::getConnection()}.
* *
* @var array * @var string[]
*/ */
private static $_driverMap = [ private static $_driverMap = [
'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver', 'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
...@@ -46,6 +46,8 @@ final class DriverManager ...@@ -46,6 +46,8 @@ final class DriverManager
/** /**
* List of URL schemes from a database URL and their mappings to driver. * List of URL schemes from a database URL and their mappings to driver.
*
* @var string[]
*/ */
private static $driverSchemeAliases = [ private static $driverSchemeAliases = [
'db2' => 'ibm_db2', 'db2' => 'ibm_db2',
...@@ -113,7 +115,7 @@ final class DriverManager ...@@ -113,7 +115,7 @@ final class DriverManager
* <b>driverClass</b>: * <b>driverClass</b>:
* The driver class to use. * The driver class to use.
* *
* @param array $params The parameters. * @param mixed[] $params The parameters.
* @param Configuration|null $config The configuration to use. * @param Configuration|null $config The configuration to use.
* @param EventManager|null $eventManager The event manager to use. * @param EventManager|null $eventManager The event manager to use.
* *
...@@ -185,7 +187,7 @@ final class DriverManager ...@@ -185,7 +187,7 @@ final class DriverManager
/** /**
* Returns the list of supported drivers. * Returns the list of supported drivers.
* *
* @return array * @return string[]
*/ */
public static function getAvailableDrivers() : array public static function getAvailableDrivers() : array
{ {
...@@ -195,7 +197,7 @@ final class DriverManager ...@@ -195,7 +197,7 @@ final class DriverManager
/** /**
* Checks the list of parameters. * Checks the list of parameters.
* *
* @param array $params The list of parameters. * @param mixed[] $params The list of parameters.
* *
* @throws DBALException * @throws DBALException
*/ */
...@@ -235,9 +237,9 @@ final class DriverManager ...@@ -235,9 +237,9 @@ final class DriverManager
* Extracts parts from a database URL, if present, and returns an * Extracts parts from a database URL, if present, and returns an
* updated list of parameters. * updated list of parameters.
* *
* @param array $params The list of parameters. * @param mixed[] $params The list of parameters.
* *
* @return array A modified list of parameters with info from a database * @return mixed[] A modified list of parameters with info from a database
* URL extracted into indidivual parameter parts. * URL extracted into indidivual parameter parts.
* *
* @throws DBALException * @throws DBALException
...@@ -291,10 +293,10 @@ final class DriverManager ...@@ -291,10 +293,10 @@ final class DriverManager
* *
* @see parseDatabaseUrlScheme * @see parseDatabaseUrlScheme
* *
* @param array $url The URL parts to evaluate. * @param mixed[] $url The URL parts to evaluate.
* @param array $params The connection parameters to resolve. * @param mixed[] $params The connection parameters to resolve.
* *
* @return array The resolved connection parameters. * @return mixed[] The resolved connection parameters.
*/ */
private static function parseDatabaseUrlPath(array $url, array $params) : array private static function parseDatabaseUrlPath(array $url, array $params) : array
{ {
...@@ -320,10 +322,10 @@ final class DriverManager ...@@ -320,10 +322,10 @@ final class DriverManager
/** /**
* Parses the query part of the given connection URL and resolves the given connection parameters. * Parses the query part of the given connection URL and resolves the given connection parameters.
* *
* @param array $url The connection URL parts to evaluate. * @param mixed[] $url The connection URL parts to evaluate.
* @param array $params The connection parameters to resolve. * @param mixed[] $params The connection parameters to resolve.
* *
* @return array The resolved connection parameters. * @return mixed[] The resolved connection parameters.
*/ */
private static function parseDatabaseUrlQuery(array $url, array $params) : array private static function parseDatabaseUrlQuery(array $url, array $params) : array
{ {
...@@ -345,10 +347,10 @@ final class DriverManager ...@@ -345,10 +347,10 @@ final class DriverManager
* *
* @see normalizeDatabaseUrlPath * @see normalizeDatabaseUrlPath
* *
* @param array $url The regular connection URL parts to evaluate. * @param mixed[] $url The regular connection URL parts to evaluate.
* @param array $params The connection parameters to resolve. * @param mixed[] $params The connection parameters to resolve.
* *
* @return array The resolved connection parameters. * @return mixed[] The resolved connection parameters.
*/ */
private static function parseRegularDatabaseUrlPath(array $url, array $params) : array private static function parseRegularDatabaseUrlPath(array $url, array $params) : array
{ {
...@@ -364,10 +366,10 @@ final class DriverManager ...@@ -364,10 +366,10 @@ final class DriverManager
* *
* @see normalizeDatabaseUrlPath * @see normalizeDatabaseUrlPath
* *
* @param array $url The SQLite connection URL parts to evaluate. * @param mixed[] $url The SQLite connection URL parts to evaluate.
* @param array $params The connection parameters to resolve. * @param mixed[] $params The connection parameters to resolve.
* *
* @return array The resolved connection parameters. * @return mixed[] The resolved connection parameters.
*/ */
private static function parseSqliteDatabaseUrlPath(array $url, array $params) : array private static function parseSqliteDatabaseUrlPath(array $url, array $params) : array
{ {
...@@ -385,12 +387,12 @@ final class DriverManager ...@@ -385,12 +387,12 @@ final class DriverManager
/** /**
* Parses the scheme part from given connection URL and resolves the given connection parameters. * Parses the scheme part from given connection URL and resolves the given connection parameters.
* *
* @param array $url The connection URL parts to evaluate. * @param mixed[] $url The connection URL parts to evaluate.
* @param array $params The connection parameters to resolve. * @param mixed[] $params The connection parameters to resolve.
* *
* @return array The resolved connection parameters. * @return mixed[] The resolved connection parameters.
* *
* @throws DBALException if parsing failed or resolution is not possible. * @throws DBALException If parsing failed or resolution is not possible.
*/ */
private static function parseDatabaseUrlScheme(array $url, array $params) : array private static function parseDatabaseUrlScheme(array $url, array $params) : array
{ {
......
...@@ -25,7 +25,7 @@ use function implode; ...@@ -25,7 +25,7 @@ use function implode;
*/ */
class OracleSessionInit implements EventSubscriber class OracleSessionInit implements EventSubscriber
{ {
/** @var array */ /** @var string[] */
protected $_defaultSessionVars = [ protected $_defaultSessionVars = [
'NLS_TIME_FORMAT' => 'HH24:MI:SS', 'NLS_TIME_FORMAT' => 'HH24:MI:SS',
'NLS_DATE_FORMAT' => 'YYYY-MM-DD HH24:MI:SS', 'NLS_DATE_FORMAT' => 'YYYY-MM-DD HH24:MI:SS',
...@@ -35,7 +35,7 @@ class OracleSessionInit implements EventSubscriber ...@@ -35,7 +35,7 @@ class OracleSessionInit implements EventSubscriber
]; ];
/** /**
* @param array $oracleSessionVars * @param string[] $oracleSessionVars
*/ */
public function __construct(array $oracleSessionVars = []) public function __construct(array $oracleSessionVars = [])
{ {
......
...@@ -24,7 +24,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs ...@@ -24,7 +24,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform) public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform)
...@@ -59,7 +59,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs ...@@ -59,7 +59,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs
*/ */
...@@ -75,7 +75,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs ...@@ -75,7 +75,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -24,7 +24,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs ...@@ -24,7 +24,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, AbstractPlatform $platform) public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, AbstractPlatform $platform)
...@@ -59,7 +59,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs ...@@ -59,7 +59,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
*/ */
...@@ -75,7 +75,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs ...@@ -75,7 +75,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -20,7 +20,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs ...@@ -20,7 +20,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
public function __construct(TableDiff $tableDiff, AbstractPlatform $platform) public function __construct(TableDiff $tableDiff, AbstractPlatform $platform)
...@@ -46,7 +46,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs ...@@ -46,7 +46,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
*/ */
...@@ -62,7 +62,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs ...@@ -62,7 +62,7 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -24,7 +24,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs ...@@ -24,7 +24,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform) public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform)
...@@ -59,7 +59,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs ...@@ -59,7 +59,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs
*/ */
...@@ -75,7 +75,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs ...@@ -75,7 +75,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -27,7 +27,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs ...@@ -27,7 +27,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
/** /**
...@@ -74,7 +74,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs ...@@ -74,7 +74,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs
*/ */
...@@ -90,7 +90,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs ...@@ -90,7 +90,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -19,7 +19,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs ...@@ -19,7 +19,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
/** /**
* Raw column data as fetched from the database. * Raw column data as fetched from the database.
* *
* @var array * @var mixed[]
*/ */
private $_tableColumn; private $_tableColumn;
...@@ -33,7 +33,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs ...@@ -33,7 +33,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
private $_connection; private $_connection;
/** /**
* @param array $tableColumn * @param mixed[] $tableColumn
* @param string $table * @param string $table
* @param string $database * @param string $database
*/ */
...@@ -67,7 +67,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs ...@@ -67,7 +67,7 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getTableColumn() public function getTableColumn()
{ {
......
...@@ -24,7 +24,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs ...@@ -24,7 +24,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
public function __construct(Column $column, Table $table, AbstractPlatform $platform) public function __construct(Column $column, Table $table, AbstractPlatform $platform)
...@@ -59,7 +59,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs ...@@ -59,7 +59,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs * @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs
*/ */
...@@ -75,7 +75,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs ...@@ -75,7 +75,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Event; namespace Doctrine\DBAL\Event;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use function array_merge; use function array_merge;
use function is_array; use function is_array;
...@@ -17,21 +18,21 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -17,21 +18,21 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
/** @var Table */ /** @var Table */
private $_table; private $_table;
/** @var array */ /** @var Column[] */
private $_columns; private $_columns;
/** @var array */ /** @var mixed[] */
private $_options; private $_options;
/** @var AbstractPlatform */ /** @var AbstractPlatform */
private $_platform; private $_platform;
/** @var array */ /** @var string[] */
private $_sql = []; private $_sql = [];
/** /**
* @param array $columns * @param Column[] $columns
* @param array $options * @param mixed[] $options
*/ */
public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform) public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
{ {
...@@ -50,7 +51,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -50,7 +51,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return Column[]
*/ */
public function getColumns() public function getColumns()
{ {
...@@ -58,7 +59,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -58,7 +59,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getOptions() public function getOptions()
{ {
...@@ -74,7 +75,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -74,7 +75,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
} }
/** /**
* @param string|array $sql * @param string|string[] $sql
* *
* @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
*/ */
...@@ -90,7 +91,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -90,7 +91,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return string[]
*/ */
public function getSql() public function getSql()
{ {
......
...@@ -19,7 +19,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs ...@@ -19,7 +19,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
/** /**
* Raw index data as fetched from the database. * Raw index data as fetched from the database.
* *
* @var array * @var mixed[]
*/ */
private $_tableIndex; private $_tableIndex;
...@@ -30,7 +30,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs ...@@ -30,7 +30,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
private $_connection; private $_connection;
/** /**
* @param array $tableIndex * @param mixed[] $tableIndex
* @param string $table * @param string $table
*/ */
public function __construct(array $tableIndex, $table, Connection $connection) public function __construct(array $tableIndex, $table, Connection $connection)
...@@ -61,7 +61,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs ...@@ -61,7 +61,7 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getTableIndex() public function getTableIndex()
{ {
......
...@@ -56,7 +56,7 @@ class TableGenerator ...@@ -56,7 +56,7 @@ class TableGenerator
/** @var string */ /** @var string */
private $generatorTableName; private $generatorTableName;
/** @var array */ /** @var mixed[][] */
private $sequences = []; private $sequences = [];
/** /**
......
...@@ -14,7 +14,7 @@ class DebugStack implements SQLLogger ...@@ -14,7 +14,7 @@ class DebugStack implements SQLLogger
/** /**
* Executed SQL queries. * Executed SQL queries.
* *
* @var array * @var mixed[][]
*/ */
public $queries = []; public $queries = [];
......
...@@ -13,8 +13,8 @@ interface SQLLogger ...@@ -13,8 +13,8 @@ interface SQLLogger
* Logs a SQL statement somewhere. * Logs a SQL statement somewhere.
* *
* @param string $sql The SQL to be executed. * @param string $sql The SQL to be executed.
* @param array|null $params The SQL parameters. * @param mixed[]|null $params The SQL parameters.
* @param array|null $types The SQL parameter types. * @param int[]|string[]|null $types The SQL parameter types.
* *
* @return void * @return void
*/ */
......
...@@ -618,8 +618,8 @@ class DB2Platform extends AbstractPlatform ...@@ -618,8 +618,8 @@ class DB2Platform extends AbstractPlatform
* *
* @param Table $table The table to gather the SQL for. * @param Table $table The table to gather the SQL for.
* @param ColumnDiff $columnDiff The column diff to evaluate. * @param ColumnDiff $columnDiff The column diff to evaluate.
* @param array $sql The sequence of table alteration statements to fill. * @param string[] $sql The sequence of table alteration statements to fill.
* @param array $queryParts The sequence of column alteration clauses to fill. * @param mixed[] $queryParts The sequence of column alteration clauses to fill.
*/ */
private function gatherAlterColumnSQL(Table $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts) private function gatherAlterColumnSQL(Table $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts)
{ {
...@@ -649,7 +649,7 @@ class DB2Platform extends AbstractPlatform ...@@ -649,7 +649,7 @@ class DB2Platform extends AbstractPlatform
* *
* @param ColumnDiff $columnDiff The column diff to evaluate. * @param ColumnDiff $columnDiff The column diff to evaluate.
* *
* @return array * @return string[]
*/ */
private function getAlterColumnClausesSQL(ColumnDiff $columnDiff) private function getAlterColumnClausesSQL(ColumnDiff $columnDiff)
{ {
......
...@@ -19,7 +19,6 @@ use function is_array; ...@@ -19,7 +19,6 @@ use function is_array;
use function is_bool; use function is_bool;
use function is_numeric; use function is_numeric;
use function is_string; use function is_string;
use function join;
use function sprintf; use function sprintf;
use function trim; use function trim;
...@@ -51,7 +50,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -51,7 +50,7 @@ class DrizzlePlatform extends AbstractPlatform
{ {
$args = func_get_args(); $args = func_get_args();
return 'CONCAT(' . join(', ', (array) $args) . ')'; return 'CONCAT(' . implode(', ', (array) $args) . ')';
} }
/** /**
...@@ -237,7 +236,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -237,7 +236,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* Build SQL for table options * Build SQL for table options
* *
* @param array $options * @param mixed[] $options
* *
* @return string * @return string
*/ */
...@@ -286,7 +285,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -286,7 +285,7 @@ class DrizzlePlatform extends AbstractPlatform
/** /**
* Build SQL for partition options. * Build SQL for partition options.
* *
* @param array $options * @param mixed[] $options
* *
* @return string * @return string
*/ */
......
...@@ -13,7 +13,7 @@ use function strtoupper; ...@@ -13,7 +13,7 @@ use function strtoupper;
*/ */
abstract class KeywordList abstract class KeywordList
{ {
/** @var array|null */ /** @var string[]|null */
private $keywords = null; private $keywords = null;
/** /**
...@@ -43,7 +43,7 @@ abstract class KeywordList ...@@ -43,7 +43,7 @@ abstract class KeywordList
/** /**
* Returns the list of keywords. * Returns the list of keywords.
* *
* @return array * @return string[]
*/ */
abstract protected function getKeywords(); abstract protected function getKeywords();
......
...@@ -17,7 +17,7 @@ class ReservedKeywordsValidator implements Visitor ...@@ -17,7 +17,7 @@ class ReservedKeywordsValidator implements Visitor
/** @var KeywordList[] */ /** @var KeywordList[] */
private $keywordLists = []; private $keywordLists = [];
/** @var array */ /** @var string[] */
private $violations = []; private $violations = [];
/** /**
...@@ -29,7 +29,7 @@ class ReservedKeywordsValidator implements Visitor ...@@ -29,7 +29,7 @@ class ReservedKeywordsValidator implements Visitor
} }
/** /**
* @return array * @return string[]
*/ */
public function getViolations() public function getViolations()
{ {
...@@ -39,7 +39,7 @@ class ReservedKeywordsValidator implements Visitor ...@@ -39,7 +39,7 @@ class ReservedKeywordsValidator implements Visitor
/** /**
* @param string $word * @param string $word
* *
* @return array * @return string[]
*/ */
private function isReservedWord($word) private function isReservedWord($word)
{ {
...@@ -61,7 +61,7 @@ class ReservedKeywordsValidator implements Visitor ...@@ -61,7 +61,7 @@ class ReservedKeywordsValidator implements Visitor
/** /**
* @param string $asset * @param string $asset
* @param array $violatedPlatforms * @param string[] $violatedPlatforms
* *
* @return void * @return void
*/ */
......
...@@ -22,7 +22,6 @@ use function implode; ...@@ -22,7 +22,6 @@ use function implode;
use function in_array; use function in_array;
use function is_numeric; use function is_numeric;
use function is_string; use function is_string;
use function join;
use function sprintf; use function sprintf;
use function str_replace; use function str_replace;
use function strtoupper; use function strtoupper;
...@@ -107,9 +106,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -107,9 +106,7 @@ class MySqlPlatform extends AbstractPlatform
*/ */
public function getConcatExpression() public function getConcatExpression()
{ {
$args = func_get_args(); return sprintf('CONCAT(%s)', implode(', ', func_get_args()));
return 'CONCAT(' . join(', ', (array) $args) . ')';
} }
/** /**
...@@ -194,11 +191,11 @@ class MySqlPlatform extends AbstractPlatform ...@@ -194,11 +191,11 @@ class MySqlPlatform extends AbstractPlatform
'FROM information_schema.key_column_usage k /*!50116 ' . 'FROM information_schema.key_column_usage k /*!50116 ' .
'INNER JOIN information_schema.referential_constraints c ON ' . 'INNER JOIN information_schema.referential_constraints c ON ' .
' c.constraint_name = k.constraint_name AND ' . ' c.constraint_name = k.constraint_name AND ' .
" c.table_name = $table */ WHERE k.table_name = $table"; ' c.table_name = ' . $table . ' */ WHERE k.table_name = ' . $table;
$databaseNameSql = $database ?? 'DATABASE()'; $databaseNameSql = $database ?? 'DATABASE()';
$sql .= " AND k.table_schema = $databaseNameSql /*!50116 AND c.constraint_schema = $databaseNameSql */"; $sql .= ' AND k.table_schema = ' . $databaseNameSql . ' /*!50116 AND c.constraint_schema = ' . $databaseNameSql . ' */';
$sql .= ' AND k.`REFERENCED_COLUMN_NAME` is not NULL'; $sql .= ' AND k.`REFERENCED_COLUMN_NAME` is not NULL';
return $sql; return $sql;
...@@ -244,9 +241,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -244,9 +241,7 @@ class MySqlPlatform extends AbstractPlatform
* MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 * MEDIUMTEXT : 2 ^ 24 - 1 = 16777215
* LONGTEXT : 2 ^ 32 - 1 = 4294967295 * LONGTEXT : 2 ^ 32 - 1 = 4294967295
* *
* @param array $field * {@inheritDoc}
*
* @return string
*/ */
public function getClobTypeDeclarationSQL(array $field) public function getClobTypeDeclarationSQL(array $field)
{ {
...@@ -470,7 +465,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -470,7 +465,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* Build SQL for table options * Build SQL for table options
* *
* @param array $options * @param mixed[] $options
* *
* @return string * @return string
*/ */
...@@ -526,7 +521,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -526,7 +521,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* Build SQL for partition options. * Build SQL for partition options.
* *
* @param array $options * @param mixed[] $options
* *
* @return string * @return string
*/ */
...@@ -724,7 +719,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -724,7 +719,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* @param TableDiff $diff The table diff to gather the SQL for. * @param TableDiff $diff The table diff to gather the SQL for.
* *
* @return array * @return string[]
*/ */
private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff) private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff)
{ {
...@@ -764,7 +759,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -764,7 +759,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* @param TableDiff $diff The table diff to gather the SQL for. * @param TableDiff $diff The table diff to gather the SQL for.
* *
* @return array * @return string[]
*/ */
protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff) protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{ {
...@@ -790,7 +785,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -790,7 +785,7 @@ class MySqlPlatform extends AbstractPlatform
* *
* @param TableDiff $diff The table diff to evaluate. * @param TableDiff $diff The table diff to evaluate.
* *
* @return array * @return ForeignKeyConstraint[]
*/ */
private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff) private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff)
{ {
...@@ -832,7 +827,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -832,7 +827,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* @param TableDiff $diff The table diff to gather the SQL for. * @param TableDiff $diff The table diff to gather the SQL for.
* *
* @return array * @return string[]
*/ */
protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff) protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{ {
...@@ -912,7 +907,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -912,7 +907,7 @@ class MySqlPlatform extends AbstractPlatform
/** /**
* Get unsigned declaration for a column. * Get unsigned declaration for a column.
* *
* @param array $columnDef * @param mixed[] $columnDef
* *
* @return string * @return string
*/ */
...@@ -1097,9 +1092,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -1097,9 +1092,7 @@ class MySqlPlatform extends AbstractPlatform
* MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 * MEDIUMBLOB : 2 ^ 24 - 1 = 16777215
* LONGBLOB : 2 ^ 32 - 1 = 4294967295 * LONGBLOB : 2 ^ 32 - 1 = 4294967295
* *
* @param array $field * {@inheritDoc}
*
* @return string
*/ */
public function getBlobTypeDeclarationSQL(array $field) public function getBlobTypeDeclarationSQL(array $field)
{ {
......
...@@ -54,10 +54,10 @@ class OraclePlatform extends AbstractPlatform ...@@ -54,10 +54,10 @@ class OraclePlatform extends AbstractPlatform
public function getSubstringExpression($value, $position, $length = null) public function getSubstringExpression($value, $position, $length = null)
{ {
if ($length !== null) { if ($length !== null) {
return "SUBSTR($value, $position, $length)"; return sprintf('SUBSTR(%s, %d, %d)', $value, $position, $length);
} }
return "SUBSTR($value, $position)"; return sprintf('SUBSTR(%s, %d)', $value, $position);
} }
/** /**
...@@ -478,7 +478,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -478,7 +478,7 @@ class OraclePlatform extends AbstractPlatform
* @param string $table * @param string $table
* @param int $start * @param int $start
* *
* @return array * @return string[]
*/ */
public function getCreateAutoincrementSql($name, $table, $start = 1) public function getCreateAutoincrementSql($name, $table, $start = 1)
{ {
...@@ -542,7 +542,7 @@ END;'; ...@@ -542,7 +542,7 @@ END;';
* *
* @param string $table The table name to drop the autoincrement for. * @param string $table The table name to drop the autoincrement for.
* *
* @return array * @return string[]
*/ */
public function getDropAutoincrementSql($table) public function getDropAutoincrementSql($table)
{ {
...@@ -657,20 +657,30 @@ END;'; ...@@ -657,20 +657,30 @@ END;';
$database = $this->quoteStringLiteral($database->getName()); $database = $this->quoteStringLiteral($database->getName());
$tabColumnsTableName = 'all_tab_columns'; $tabColumnsTableName = 'all_tab_columns';
$colCommentsTableName = 'all_col_comments'; $colCommentsTableName = 'all_col_comments';
$tabColumnsOwnerCondition = 'AND c.owner = ' . $database; $tabColumnsOwnerCondition = ' AND c.owner = ' . $database;
$colCommentsOwnerCondition = 'AND d.OWNER = c.OWNER'; $colCommentsOwnerCondition = ' AND d.OWNER = c.OWNER';
} }
return "SELECT c.*, return sprintf(
<<<'SQL'
SELECT c.*,
( (
SELECT d.comments SELECT d.comments
FROM $colCommentsTableName d FROM %s d
WHERE d.TABLE_NAME = c.TABLE_NAME " . $colCommentsOwnerCondition . " WHERE d.TABLE_NAME = c.TABLE_NAME%s
AND d.COLUMN_NAME = c.COLUMN_NAME AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments ) AS comments
FROM $tabColumnsTableName c FROM %s c
WHERE c.table_name = " . $table . " $tabColumnsOwnerCondition WHERE c.table_name = %s%s
ORDER BY c.column_id"; ORDER BY c.column_id
SQL
,
$colCommentsTableName,
$colCommentsOwnerCondition,
$tabColumnsTableName,
$table,
$tabColumnsOwnerCondition
);
} }
/** /**
...@@ -767,7 +777,9 @@ END;'; ...@@ -767,7 +777,9 @@ END;';
} }
$fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); $fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
if (! $comment = $this->getColumnComment($column)) { $comment = $this->getColumnComment($column);
if (! $comment) {
continue; continue;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use function sprintf;
/** /**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform. * Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
...@@ -62,8 +63,9 @@ class PostgreSQL92Platform extends PostgreSQL91Platform ...@@ -62,8 +63,9 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
*/ */
public function getCloseActiveDatabaseConnectionsSQL($database) public function getCloseActiveDatabaseConnectionsSQL($database)
{ {
$database = $this->quoteStringLiteral($database); return sprintf(
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
return "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = $database"; $this->quoteStringLiteral($database)
);
} }
} }
...@@ -27,6 +27,7 @@ use function is_array; ...@@ -27,6 +27,7 @@ use function is_array;
use function is_bool; use function is_bool;
use function is_numeric; use function is_numeric;
use function is_string; use function is_string;
use function sprintf;
use function str_replace; use function str_replace;
use function strpos; use function strpos;
use function strtolower; use function strtolower;
...@@ -42,7 +43,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -42,7 +43,7 @@ class PostgreSqlPlatform extends AbstractPlatform
/** @var bool */ /** @var bool */
private $useBooleanTrueFalseStrings = true; private $useBooleanTrueFalseStrings = true;
/** @var array PostgreSQL booleans literals */ /** @var string[][] PostgreSQL booleans literals */
private $booleanLiterals = [ private $booleanLiterals = [
'true' => [ 'true' => [
't', 't',
...@@ -316,17 +317,23 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -316,17 +317,23 @@ class PostgreSqlPlatform extends AbstractPlatform
$table = new Identifier($table); $table = new Identifier($table);
$table = $this->quoteStringLiteral($table->getName()); $table = $this->quoteStringLiteral($table->getName());
return "SELECT return sprintf(
<<<'SQL'
SELECT
quote_ident(relname) as relname quote_ident(relname) as relname
FROM FROM
pg_class pg_class
WHERE oid IN ( WHERE oid IN (
SELECT indexrelid SELECT indexrelid
FROM pg_index, pg_class FROM pg_index, pg_class
WHERE pg_class.relname = $table WHERE pg_class.relname = %s
AND pg_class.oid = pg_index.indrelid AND pg_class.oid = pg_index.indrelid
AND (indisunique = 't' OR indisprimary = 't') AND (indisunique = 't' OR indisprimary = 't')
)"; )
SQL
,
$table
);
} }
/** /**
...@@ -366,7 +373,14 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -366,7 +373,14 @@ class PostgreSqlPlatform extends AbstractPlatform
$table = new Identifier($table); $table = new Identifier($table);
$table = $this->quoteStringLiteral($table->getName()); $table = $this->quoteStringLiteral($table->getName());
return $whereClause . "$classAlias.relname = " . $table . " AND $namespaceAlias.nspname = $schema";
return $whereClause . sprintf(
'%s.relname = %s AND %s.nspname = %s',
$classAlias,
$table,
$namespaceAlias,
$schema
);
} }
/** /**
...@@ -425,7 +439,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -425,7 +439,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getDisallowDatabaseConnectionsSQL($database) public function getDisallowDatabaseConnectionsSQL($database)
{ {
return "UPDATE pg_database SET datallowconn = 'false' WHERE datname = '$database'"; return "UPDATE pg_database SET datallowconn = 'false' WHERE datname = '" . $database . "'";
} }
/** /**
...@@ -439,9 +453,8 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -439,9 +453,8 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getCloseActiveDatabaseConnectionsSQL($database) public function getCloseActiveDatabaseConnectionsSQL($database)
{ {
$database = $this->quoteStringLiteral($database); return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = '
. $this->quoteStringLiteral($database);
return "SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = $database";
} }
/** /**
...@@ -562,7 +575,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -562,7 +575,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
} else { } else {
// Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have // Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have
$query = 'ALTER ' . $oldColumnName . ' ' . 'DROP DEFAULT'; $query = 'ALTER ' . $oldColumnName . ' DROP DEFAULT';
$sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query; $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
} }
} }
...@@ -676,8 +689,12 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -676,8 +689,12 @@ class PostgreSqlPlatform extends AbstractPlatform
$columnName = new Identifier($columnName); $columnName = new Identifier($columnName);
$comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment); $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment);
return 'COMMENT ON COLUMN ' . $tableName->getQuotedName($this) . '.' . $columnName->getQuotedName($this) . return sprintf(
" IS $comment"; 'COMMENT ON COLUMN %s.%s IS %s',
$tableName->getQuotedName($this),
$columnName->getQuotedName($this),
$comment
);
} }
/** /**
...@@ -1201,6 +1218,9 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -1201,6 +1218,9 @@ class PostgreSqlPlatform extends AbstractPlatform
return parent::getDefaultValueDeclarationSQL($field); return parent::getDefaultValueDeclarationSQL($field);
} }
/**
* @param mixed[] $field
*/
private function isSerialField(array $field) : bool private function isSerialField(array $field) : bool
{ {
return $field['autoincrement'] ?? false === true && isset($field['type']) return $field['autoincrement'] ?? false === true && isset($field['type'])
......
...@@ -225,10 +225,20 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -225,10 +225,20 @@ class SQLServerPlatform extends AbstractPlatform
$table = $table->getQuotedName($this); $table = $table->getQuotedName($this);
} }
return "IF EXISTS (SELECT * FROM sysobjects WHERE name = '$index') return sprintf(
ALTER TABLE " . $table . ' DROP CONSTRAINT ' . $index . ' <<<SQL
ELSE IF EXISTS (SELECT * FROM sysobjects WHERE name = '%s')
DROP INDEX ' . $index . ' ON ' . $table; ALTER TABLE %s DROP CONSTRAINT %s
ELSE
DROP INDEX %s ON %s
SQL
,
$index,
$table,
$index,
$index,
$table
);
} }
/** /**
...@@ -357,7 +367,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -357,7 +367,7 @@ class SQLServerPlatform extends AbstractPlatform
* Returns the SQL snippet for declaring a default constraint. * Returns the SQL snippet for declaring a default constraint.
* *
* @param string $table Name of the table to return the default constraint declaration for. * @param string $table Name of the table to return the default constraint declaration for.
* @param array $column Column definition. * @param mixed[] $column Column definition.
* *
* @return string * @return string
* *
...@@ -513,8 +523,6 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -513,8 +523,6 @@ class SQLServerPlatform extends AbstractPlatform
$comment $comment
); );
} }
} else {
// todo: Original comment cannot be determined. What to do? Add, update, drop or skip?
} }
// Do not add query part if only comment has changed. // Do not add query part if only comment has changed.
...@@ -995,7 +1003,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -995,7 +1003,7 @@ class SQLServerPlatform extends AbstractPlatform
$table = $this->quoteStringLiteral($table); $table = $this->quoteStringLiteral($table);
} }
return "({$tableColumn} = {$table} AND {$schemaColumn} = {$schema})"; return sprintf('(%s = %s AND %s = %s)', $tableColumn, $table, $schemaColumn, $schema);
} }
/** /**
...@@ -1067,7 +1075,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -1067,7 +1075,7 @@ class SQLServerPlatform extends AbstractPlatform
, reverse(stuff(reverse(@c), 1, patindex(@pat, reverse(@c)) - 1, null)) as trim_trailing , reverse(stuff(reverse(@c), 1, patindex(@pat, reverse(@c)) - 1, null)) as trim_trailing
, reverse(stuff(reverse(stuff(@c, 1, patindex(@pat, @c) - 1, null)), 1, patindex(@pat, reverse(stuff(@c, 1, patindex(@pat, @c) - 1, null))) - 1, null)) as trim_both; , reverse(stuff(reverse(stuff(@c, 1, patindex(@pat, @c) - 1, null)), 1, patindex(@pat, reverse(stuff(@c, 1, patindex(@pat, @c) - 1, null))) - 1, null)) as trim_both;
*/ */
$pattern = "'%[^' + $char + ']%'"; $pattern = "'%[^' + " . $char . " + ']%'";
if ($pos === TrimMode::LEADING) { if ($pos === TrimMode::LEADING) {
return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)'; return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)';
......
...@@ -423,9 +423,11 @@ class SqlitePlatform extends AbstractPlatform ...@@ -423,9 +423,11 @@ class SqlitePlatform extends AbstractPlatform
public function getListTableConstraintsSQL($table) public function getListTableConstraintsSQL($table)
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
$table = $this->quoteStringLiteral($table);
return "SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = $table AND sql NOT NULL ORDER BY name"; return sprintf(
"SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = %s AND sql NOT NULL ORDER BY name",
$this->quoteStringLiteral($table)
);
} }
/** /**
...@@ -434,9 +436,8 @@ class SqlitePlatform extends AbstractPlatform ...@@ -434,9 +436,8 @@ class SqlitePlatform extends AbstractPlatform
public function getListTableColumnsSQL($table, $currentDatabase = null) public function getListTableColumnsSQL($table, $currentDatabase = null)
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
$table = $this->quoteStringLiteral($table);
return "PRAGMA table_info($table)"; return sprintf('PRAGMA table_info(%s)', $this->quoteStringLiteral($table));
} }
/** /**
...@@ -445,9 +446,8 @@ class SqlitePlatform extends AbstractPlatform ...@@ -445,9 +446,8 @@ class SqlitePlatform extends AbstractPlatform
public function getListTableIndexesSQL($table, $currentDatabase = null) public function getListTableIndexesSQL($table, $currentDatabase = null)
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
$table = $this->quoteStringLiteral($table);
return "PRAGMA index_list($table)"; return sprintf('PRAGMA index_list(%s)', $this->quoteStringLiteral($table));
} }
/** /**
...@@ -797,9 +797,8 @@ class SqlitePlatform extends AbstractPlatform ...@@ -797,9 +797,8 @@ class SqlitePlatform extends AbstractPlatform
public function getListTableForeignKeysSQL($table, $database = null) public function getListTableForeignKeysSQL($table, $database = null)
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
$table = $this->quoteStringLiteral($table);
return "PRAGMA foreign_key_list($table)"; return sprintf('PRAGMA foreign_key_list(%s)', $this->quoteStringLiteral($table));
} }
/** /**
...@@ -998,7 +997,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -998,7 +997,7 @@ class SqlitePlatform extends AbstractPlatform
} }
/** /**
* @return array * @return string[]
*/ */
private function getColumnNamesInAlteredTable(TableDiff $diff) private function getColumnNamesInAlteredTable(TableDiff $diff)
{ {
...@@ -1097,7 +1096,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -1097,7 +1096,7 @@ class SqlitePlatform extends AbstractPlatform
} }
/** /**
* @return array * @return ForeignKeyConstraint[]
*/ */
private function getForeignKeysInAlteredTable(TableDiff $diff) private function getForeignKeysInAlteredTable(TableDiff $diff)
{ {
...@@ -1149,7 +1148,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -1149,7 +1148,7 @@ class SqlitePlatform extends AbstractPlatform
} }
/** /**
* @return array * @return Index[]
*/ */
private function getPrimaryIndexInAlteredTable(TableDiff $diff) private function getPrimaryIndexInAlteredTable(TableDiff $diff)
{ {
......
...@@ -181,7 +181,7 @@ class Statement implements IteratorAggregate, \Doctrine\DBAL\Driver\Statement ...@@ -181,7 +181,7 @@ class Statement implements IteratorAggregate, \Doctrine\DBAL\Driver\Statement
* @param int $iterateRow * @param int $iterateRow
* @param bool $fixCase * @param bool $fixCase
* *
* @return array * @return mixed
*/ */
protected function fixRow($row, $iterateRow, $fixCase) protected function fixRow($row, $iterateRow, $fixCase)
{ {
......
...@@ -33,13 +33,13 @@ class CompositeExpression implements Countable ...@@ -33,13 +33,13 @@ class CompositeExpression implements Countable
/** /**
* Each expression part of the composite expression. * Each expression part of the composite expression.
* *
* @var array * @var self[]|string[]
*/ */
private $parts = []; private $parts = [];
/** /**
* @param string $type Instance type of composite expression. * @param string $type Instance type of composite expression.
* @param array $parts Composition of expressions to be joined on composite expression. * @param self[]|string[] $parts Composition of expressions to be joined on composite expression.
*/ */
public function __construct($type, array $parts = []) public function __construct($type, array $parts = [])
{ {
...@@ -51,7 +51,7 @@ class CompositeExpression implements Countable ...@@ -51,7 +51,7 @@ class CompositeExpression implements Countable
/** /**
* Adds multiple parts to composite expression. * Adds multiple parts to composite expression.
* *
* @param array $parts * @param self[]|string[] $parts
* *
* @return \Doctrine\DBAL\Query\Expression\CompositeExpression * @return \Doctrine\DBAL\Query\Expression\CompositeExpression
*/ */
......
...@@ -263,7 +263,7 @@ class ExpressionBuilder ...@@ -263,7 +263,7 @@ class ExpressionBuilder
* Creates a IN () comparison expression with the given arguments. * Creates a IN () comparison expression with the given arguments.
* *
* @param string $x The field in string format to be inspected by IN() comparison. * @param string $x The field in string format to be inspected by IN() comparison.
* @param string|array $y The placeholder or the array of values to be used by IN() comparison. * @param string|string[] $y The placeholder or the array of values to be used by IN() comparison.
* *
* @return string * @return string
*/ */
...@@ -276,7 +276,7 @@ class ExpressionBuilder ...@@ -276,7 +276,7 @@ class ExpressionBuilder
* Creates a NOT IN () comparison expression with the given arguments. * Creates a NOT IN () comparison expression with the given arguments.
* *
* @param string $x The field in string format to be inspected by NOT IN() comparison. * @param string $x The field in string format to be inspected by NOT IN() comparison.
* @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison. * @param string|string[] $y The placeholder or the array of values to be used by NOT IN() comparison.
* *
* @return string * @return string
*/ */
......
...@@ -54,7 +54,11 @@ class QueryBuilder ...@@ -54,7 +54,11 @@ class QueryBuilder
*/ */
private $connection; private $connection;
/** @var array The array of SQL parts collected. */ /**
* The array of SQL parts collected.
*
* @var mixed[]
*/
private $sqlParts = [ private $sqlParts = [
'select' => [], 'select' => [],
'from' => [], 'from' => [],
...@@ -77,14 +81,14 @@ class QueryBuilder ...@@ -77,14 +81,14 @@ class QueryBuilder
/** /**
* The query parameters. * The query parameters.
* *
* @var array * @var mixed[]
*/ */
private $params = []; private $params = [];
/** /**
* The parameter type map of this query. * The parameter type map of this query.
* *
* @var array * @var int[]|string[]
*/ */
private $paramTypes = []; private $paramTypes = [];
...@@ -285,8 +289,8 @@ class QueryBuilder ...@@ -285,8 +289,8 @@ class QueryBuilder
* )); * ));
* </code> * </code>
* *
* @param array $params The query parameters to set. * @param mixed[] $params The query parameters to set.
* @param array $types The query parameters types to set. * @param int[]|string[] $types The query parameters types to set.
* *
* @return $this This QueryBuilder instance. * @return $this This QueryBuilder instance.
*/ */
...@@ -301,7 +305,7 @@ class QueryBuilder ...@@ -301,7 +305,7 @@ class QueryBuilder
/** /**
* Gets all defined query parameters for the query being constructed indexed by parameter index or name. * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
* *
* @return array The currently defined query parameters indexed by parameter index or name. * @return mixed[] The currently defined query parameters indexed by parameter index or name.
*/ */
public function getParameters() public function getParameters()
{ {
...@@ -323,7 +327,7 @@ class QueryBuilder ...@@ -323,7 +327,7 @@ class QueryBuilder
/** /**
* Gets all defined query parameter types for the query being constructed indexed by parameter index or name. * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
* *
* @return array The currently defined query parameter types indexed by parameter index or name. * @return int[]|string[] The currently defined query parameter types indexed by parameter index or name.
*/ */
public function getParameterTypes() public function getParameterTypes()
{ {
...@@ -582,9 +586,7 @@ class QueryBuilder ...@@ -582,9 +586,7 @@ class QueryBuilder
return $this; return $this;
} }
return $this->add('from', [ return $this->add('from', ['table' => $insert]);
'table' => $insert,
]);
} }
/** /**
...@@ -934,7 +936,7 @@ class QueryBuilder ...@@ -934,7 +936,7 @@ class QueryBuilder
* ); * );
* </code> * </code>
* *
* @param array $values The values to specify for the insert query indexed by column names. * @param mixed[] $values The values to specify for the insert query indexed by column names.
* *
* @return $this This QueryBuilder instance. * @return $this This QueryBuilder instance.
*/ */
...@@ -1048,7 +1050,7 @@ class QueryBuilder ...@@ -1048,7 +1050,7 @@ class QueryBuilder
/** /**
* Gets all query parts. * Gets all query parts.
* *
* @return array * @return mixed[]
*/ */
public function getQueryParts() public function getQueryParts()
{ {
...@@ -1058,7 +1060,7 @@ class QueryBuilder ...@@ -1058,7 +1060,7 @@ class QueryBuilder
/** /**
* Resets SQL parts. * Resets SQL parts.
* *
* @param array|null $queryPartNames * @param string[]|null $queryPartNames
* *
* @return $this This QueryBuilder instance. * @return $this This QueryBuilder instance.
*/ */
...@@ -1147,7 +1149,7 @@ class QueryBuilder ...@@ -1147,7 +1149,7 @@ class QueryBuilder
} }
/** /**
* @param array $knownAliases * @param string[] $knownAliases
* *
* @throws QueryException * @throws QueryException
*/ */
...@@ -1286,7 +1288,7 @@ class QueryBuilder ...@@ -1286,7 +1288,7 @@ class QueryBuilder
/** /**
* @param string $fromAlias * @param string $fromAlias
* @param array $knownAliases * @param string[] $knownAliases
* *
* @return string * @return string
* *
......
...@@ -9,7 +9,7 @@ class QueryException extends DBALException ...@@ -9,7 +9,7 @@ class QueryException extends DBALException
{ {
/** /**
* @param string $alias * @param string $alias
* @param array $registeredAliases * @param string[] $registeredAliases
* *
* @return \Doctrine\DBAL\Query\QueryException * @return \Doctrine\DBAL\Query\QueryException
*/ */
...@@ -22,7 +22,7 @@ class QueryException extends DBALException ...@@ -22,7 +22,7 @@ class QueryException extends DBALException
/** /**
* @param string $alias * @param string $alias
* @param array $registeredAliases * @param string[] $registeredAliases
* *
* @return \Doctrine\DBAL\Query\QueryException * @return \Doctrine\DBAL\Query\QueryException
*/ */
......
...@@ -43,7 +43,7 @@ class SQLParserUtils ...@@ -43,7 +43,7 @@ class SQLParserUtils
* @param string $statement * @param string $statement
* @param bool $isPositional * @param bool $isPositional
* *
* @return array * @return int[]
*/ */
public static function getPlaceholderPositions($statement, $isPositional = true) public static function getPlaceholderPositions($statement, $isPositional = true)
{ {
...@@ -56,7 +56,7 @@ class SQLParserUtils ...@@ -56,7 +56,7 @@ class SQLParserUtils
$paramMap = []; $paramMap = [];
foreach (self::getUnquotedStatementFragments($statement) as $fragment) { foreach (self::getUnquotedStatementFragments($statement) as $fragment) {
preg_match_all("/$token/", $fragment[0], $matches, PREG_OFFSET_CAPTURE); preg_match_all('/' . $token . '/', $fragment[0], $matches, PREG_OFFSET_CAPTURE);
foreach ($matches[0] as $placeholder) { foreach ($matches[0] as $placeholder) {
if ($isPositional) { if ($isPositional) {
$paramMap[] = $placeholder[1] + $fragment[1]; $paramMap[] = $placeholder[1] + $fragment[1];
...@@ -74,10 +74,10 @@ class SQLParserUtils ...@@ -74,10 +74,10 @@ class SQLParserUtils
* For a positional query this method can rewrite the sql statement with regard to array parameters. * For a positional query this method can rewrite the sql statement with regard to array parameters.
* *
* @param string $query The SQL query to execute. * @param string $query The SQL query to execute.
* @param array $params The parameters to bind to the query. * @param mixed[] $params The parameters to bind to the query.
* @param array $types The types the previous parameters are in. * @param int[]|string[] $types The types the previous parameters are in.
* *
* @return array * @return mixed[]
* *
* @throws SQLParserUtilsException * @throws SQLParserUtilsException
*/ */
...@@ -197,7 +197,7 @@ class SQLParserUtils ...@@ -197,7 +197,7 @@ class SQLParserUtils
* *
* @param string $statement * @param string $statement
* *
* @return array * @return mixed[][]
*/ */
private static function getUnquotedStatementFragments($statement) private static function getUnquotedStatementFragments($statement)
{ {
...@@ -205,14 +205,14 @@ class SQLParserUtils ...@@ -205,14 +205,14 @@ class SQLParserUtils
self::ESCAPED_DOUBLE_QUOTED_TEXT . '|' . self::ESCAPED_DOUBLE_QUOTED_TEXT . '|' .
self::ESCAPED_BACKTICK_QUOTED_TEXT . '|' . self::ESCAPED_BACKTICK_QUOTED_TEXT . '|' .
self::ESCAPED_BRACKET_QUOTED_TEXT; self::ESCAPED_BRACKET_QUOTED_TEXT;
preg_match_all("/([^'\"`\[]+)(?:$literal)?/s", $statement, $fragments, PREG_OFFSET_CAPTURE); preg_match_all('/([^\'"`\[]+)(?:' . $literal . ')?/s', $statement, $fragments, PREG_OFFSET_CAPTURE);
return $fragments[1]; return $fragments[1];
} }
/** /**
* @param string $paramName The name of the parameter (without a colon in front) * @param string $paramName The name of the parameter (without a colon in front)
* @param array $paramsOrTypes A hash of parameters or types * @param mixed $paramsOrTypes A hash of parameters or types
* @param bool $isParam * @param bool $isParam
* @param mixed $defaultValue An optional default value. If omitted, an exception is thrown * @param mixed $defaultValue An optional default value. If omitted, an exception is thrown
* *
......
...@@ -195,7 +195,7 @@ abstract class AbstractAsset ...@@ -195,7 +195,7 @@ abstract class AbstractAsset
* however building idents automatically for foreign keys, composite keys or such can easily create * however building idents automatically for foreign keys, composite keys or such can easily create
* very long names. * very long names.
* *
* @param array $columnNames * @param string[] $columnNames
* @param string $prefix * @param string $prefix
* @param int $maxSize * @param int $maxSize
* *
......
...@@ -90,7 +90,7 @@ abstract class AbstractSchemaManager ...@@ -90,7 +90,7 @@ abstract class AbstractSchemaManager
/** /**
* Lists the available databases for this connection. * Lists the available databases for this connection.
* *
* @return array * @return string[]
*/ */
public function listDatabases() public function listDatabases()
{ {
...@@ -104,7 +104,7 @@ abstract class AbstractSchemaManager ...@@ -104,7 +104,7 @@ abstract class AbstractSchemaManager
/** /**
* Returns a list of all namespaces in the current database. * Returns a list of all namespaces in the current database.
* *
* @return array * @return string[]
*/ */
public function listNamespaceNames() public function listNamespaceNames()
{ {
...@@ -183,7 +183,7 @@ abstract class AbstractSchemaManager ...@@ -183,7 +183,7 @@ abstract class AbstractSchemaManager
/** /**
* Returns true if all the given tables exist. * Returns true if all the given tables exist.
* *
* @param array $tableNames * @param string[] $tableNames
* *
* @return bool * @return bool
*/ */
...@@ -197,7 +197,7 @@ abstract class AbstractSchemaManager ...@@ -197,7 +197,7 @@ abstract class AbstractSchemaManager
/** /**
* Returns a list of all tables in the current database. * Returns a list of all tables in the current database.
* *
* @return array * @return string[]
*/ */
public function listTableNames() public function listTableNames()
{ {
...@@ -213,9 +213,9 @@ abstract class AbstractSchemaManager ...@@ -213,9 +213,9 @@ abstract class AbstractSchemaManager
* Filters asset names if they are configured to return only a subset of all * Filters asset names if they are configured to return only a subset of all
* the found elements. * the found elements.
* *
* @param array $assetNames * @param mixed[] $assetNames
* *
* @return array * @return mixed[]
*/ */
protected function filterAssetNames($assetNames) protected function filterAssetNames($assetNames)
{ {
...@@ -621,15 +621,17 @@ abstract class AbstractSchemaManager ...@@ -621,15 +621,17 @@ abstract class AbstractSchemaManager
*/ */
/** /**
* @param array $databases * @param mixed[] $databases
* *
* @return array * @return string[]
*/ */
protected function _getPortableDatabasesList($databases) protected function _getPortableDatabasesList($databases)
{ {
$list = []; $list = [];
foreach ($databases as $value) { foreach ($databases as $value) {
if (! $value = $this->_getPortableDatabaseDefinition($value)) { $value = $this->_getPortableDatabaseDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -642,9 +644,9 @@ abstract class AbstractSchemaManager ...@@ -642,9 +644,9 @@ abstract class AbstractSchemaManager
/** /**
* Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition. * Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
* *
* @param array $namespaces The list of namespace names in the native DBMS data definition. * @param mixed[][] $namespaces The list of namespace names in the native DBMS data definition.
* *
* @return array * @return string[]
*/ */
protected function getPortableNamespacesList(array $namespaces) protected function getPortableNamespacesList(array $namespaces)
{ {
...@@ -658,7 +660,7 @@ abstract class AbstractSchemaManager ...@@ -658,7 +660,7 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $database * @param mixed $database
* *
* @return mixed * @return mixed
*/ */
...@@ -670,7 +672,7 @@ abstract class AbstractSchemaManager ...@@ -670,7 +672,7 @@ abstract class AbstractSchemaManager
/** /**
* Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition. * Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
* *
* @param array $namespace The native DBMS namespace definition. * @param mixed[] $namespace The native DBMS namespace definition.
* *
* @return mixed * @return mixed
*/ */
...@@ -680,15 +682,17 @@ abstract class AbstractSchemaManager ...@@ -680,15 +682,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $functions * @param mixed[][] $functions
* *
* @return array * @return mixed[][]
*/ */
protected function _getPortableFunctionsList($functions) protected function _getPortableFunctionsList($functions)
{ {
$list = []; $list = [];
foreach ($functions as $value) { foreach ($functions as $value) {
if (! $value = $this->_getPortableFunctionDefinition($value)) { $value = $this->_getPortableFunctionDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -699,7 +703,7 @@ abstract class AbstractSchemaManager ...@@ -699,7 +703,7 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $function * @param mixed[] $function
* *
* @return mixed * @return mixed
*/ */
...@@ -709,15 +713,17 @@ abstract class AbstractSchemaManager ...@@ -709,15 +713,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $triggers * @param mixed[][] $triggers
* *
* @return array * @return mixed[][]
*/ */
protected function _getPortableTriggersList($triggers) protected function _getPortableTriggersList($triggers)
{ {
$list = []; $list = [];
foreach ($triggers as $value) { foreach ($triggers as $value) {
if (! $value = $this->_getPortableTriggerDefinition($value)) { $value = $this->_getPortableTriggerDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -728,7 +734,7 @@ abstract class AbstractSchemaManager ...@@ -728,7 +734,7 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $trigger * @param mixed[] $trigger
* *
* @return mixed * @return mixed
*/ */
...@@ -738,15 +744,17 @@ abstract class AbstractSchemaManager ...@@ -738,15 +744,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $sequences * @param mixed[][] $sequences
* *
* @return array * @return Sequence[]
*/ */
protected function _getPortableSequencesList($sequences) protected function _getPortableSequencesList($sequences)
{ {
$list = []; $list = [];
foreach ($sequences as $value) { foreach ($sequences as $value) {
if (! $value = $this->_getPortableSequenceDefinition($value)) { $value = $this->_getPortableSequenceDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -757,7 +765,7 @@ abstract class AbstractSchemaManager ...@@ -757,7 +765,7 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $sequence * @param mixed[] $sequence
* *
* @return Sequence * @return Sequence
* *
...@@ -775,9 +783,9 @@ abstract class AbstractSchemaManager ...@@ -775,9 +783,9 @@ abstract class AbstractSchemaManager
* *
* @param string $table The name of the table. * @param string $table The name of the table.
* @param string $database * @param string $database
* @param array $tableColumns * @param mixed[][] $tableColumns
* *
* @return array * @return Column[]
*/ */
protected function _getPortableTableColumnList($table, $database, $tableColumns) protected function _getPortableTableColumnList($table, $database, $tableColumns)
{ {
...@@ -814,7 +822,7 @@ abstract class AbstractSchemaManager ...@@ -814,7 +822,7 @@ abstract class AbstractSchemaManager
/** /**
* Gets Table Column Definition. * Gets Table Column Definition.
* *
* @param array $tableColumn * @param mixed[] $tableColumn
* *
* @return Column * @return Column
*/ */
...@@ -823,10 +831,10 @@ abstract class AbstractSchemaManager ...@@ -823,10 +831,10 @@ abstract class AbstractSchemaManager
/** /**
* Aggregates and groups the index results according to the required data result. * Aggregates and groups the index results according to the required data result.
* *
* @param array $tableIndexRows * @param mixed[][] $tableIndexRows
* @param string|null $tableName * @param string|null $tableName
* *
* @return array * @return Index[]
*/ */
protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
{ {
...@@ -882,15 +890,17 @@ abstract class AbstractSchemaManager ...@@ -882,15 +890,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $tables * @param mixed[][] $tables
* *
* @return array * @return string[]
*/ */
protected function _getPortableTablesList($tables) protected function _getPortableTablesList($tables)
{ {
$list = []; $list = [];
foreach ($tables as $value) { foreach ($tables as $value) {
if (! $value = $this->_getPortableTableDefinition($value)) { $value = $this->_getPortableTableDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -901,9 +911,9 @@ abstract class AbstractSchemaManager ...@@ -901,9 +911,9 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $table * @param mixed $table
* *
* @return array * @return string
*/ */
protected function _getPortableTableDefinition($table) protected function _getPortableTableDefinition($table)
{ {
...@@ -911,15 +921,17 @@ abstract class AbstractSchemaManager ...@@ -911,15 +921,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $users * @param mixed[][] $users
* *
* @return array * @return string[][]
*/ */
protected function _getPortableUsersList($users) protected function _getPortableUsersList($users)
{ {
$list = []; $list = [];
foreach ($users as $value) { foreach ($users as $value) {
if (! $value = $this->_getPortableUserDefinition($value)) { $value = $this->_getPortableUserDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -930,9 +942,9 @@ abstract class AbstractSchemaManager ...@@ -930,9 +942,9 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $user * @param mixed[] $user
* *
* @return mixed * @return mixed[]
*/ */
protected function _getPortableUserDefinition($user) protected function _getPortableUserDefinition($user)
{ {
...@@ -940,15 +952,17 @@ abstract class AbstractSchemaManager ...@@ -940,15 +952,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $views * @param mixed[][] $views
* *
* @return array * @return View[]
*/ */
protected function _getPortableViewsList($views) protected function _getPortableViewsList($views)
{ {
$list = []; $list = [];
foreach ($views as $value) { foreach ($views as $value) {
if (! $view = $this->_getPortableViewDefinition($value)) { $view = $this->_getPortableViewDefinition($value);
if (! $view) {
continue; continue;
} }
...@@ -960,9 +974,9 @@ abstract class AbstractSchemaManager ...@@ -960,9 +974,9 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $view * @param mixed[] $view
* *
* @return mixed * @return View|false
*/ */
protected function _getPortableViewDefinition($view) protected function _getPortableViewDefinition($view)
{ {
...@@ -970,15 +984,17 @@ abstract class AbstractSchemaManager ...@@ -970,15 +984,17 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $tableForeignKeys * @param mixed[][] $tableForeignKeys
* *
* @return array * @return ForeignKeyConstraint[]
*/ */
protected function _getPortableTableForeignKeysList($tableForeignKeys) protected function _getPortableTableForeignKeysList($tableForeignKeys)
{ {
$list = []; $list = [];
foreach ($tableForeignKeys as $value) { foreach ($tableForeignKeys as $value) {
if (! $value = $this->_getPortableTableForeignKeyDefinition($value)) { $value = $this->_getPortableTableForeignKeyDefinition($value);
if (! $value) {
continue; continue;
} }
...@@ -989,9 +1005,9 @@ abstract class AbstractSchemaManager ...@@ -989,9 +1005,9 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array $tableForeignKey * @param mixed $tableForeignKey
* *
* @return mixed * @return ForeignKeyConstraint
*/ */
protected function _getPortableTableForeignKeyDefinition($tableForeignKey) protected function _getPortableTableForeignKeyDefinition($tableForeignKey)
{ {
...@@ -999,7 +1015,7 @@ abstract class AbstractSchemaManager ...@@ -999,7 +1015,7 @@ abstract class AbstractSchemaManager
} }
/** /**
* @param array|string $sql * @param string[]|string $sql
* *
* @return void * @return void
*/ */
...@@ -1071,7 +1087,7 @@ abstract class AbstractSchemaManager ...@@ -1071,7 +1087,7 @@ abstract class AbstractSchemaManager
* For databases that don't support subschema/namespaces this method * For databases that don't support subschema/namespaces this method
* returns the name of the currently connected database. * returns the name of the currently connected database.
* *
* @return array * @return string[]
*/ */
public function getSchemaSearchPaths() public function getSchemaSearchPaths()
{ {
......
...@@ -44,7 +44,7 @@ class Column extends AbstractAsset ...@@ -44,7 +44,7 @@ class Column extends AbstractAsset
/** @var bool */ /** @var bool */
protected $_autoincrement = false; protected $_autoincrement = false;
/** @var array */ /** @var mixed[] */
protected $_platformOptions = []; protected $_platformOptions = [];
/** @var string|null */ /** @var string|null */
...@@ -53,14 +53,14 @@ class Column extends AbstractAsset ...@@ -53,14 +53,14 @@ class Column extends AbstractAsset
/** @var string|null */ /** @var string|null */
protected $_comment = null; protected $_comment = null;
/** @var array */ /** @var mixed[] */
protected $_customSchemaOptions = []; protected $_customSchemaOptions = [];
/** /**
* Creates a new Column. * Creates a new Column.
* *
* @param string $columnName * @param string $columnName
* @param array $options * @param mixed[] $options
*/ */
public function __construct($columnName, Type $type, array $options = []) public function __construct($columnName, Type $type, array $options = [])
{ {
...@@ -70,7 +70,7 @@ class Column extends AbstractAsset ...@@ -70,7 +70,7 @@ class Column extends AbstractAsset
} }
/** /**
* @param array $options * @param mixed[] $options
* *
* @return Column * @return Column
*/ */
...@@ -201,7 +201,7 @@ class Column extends AbstractAsset ...@@ -201,7 +201,7 @@ class Column extends AbstractAsset
} }
/** /**
* @param array $platformOptions * @param mixed[] $platformOptions
* *
* @return Column * @return Column
*/ */
...@@ -302,7 +302,7 @@ class Column extends AbstractAsset ...@@ -302,7 +302,7 @@ class Column extends AbstractAsset
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getPlatformOptions() public function getPlatformOptions()
{ {
...@@ -411,7 +411,7 @@ class Column extends AbstractAsset ...@@ -411,7 +411,7 @@ class Column extends AbstractAsset
} }
/** /**
* @param array $customSchemaOptions * @param mixed[] $customSchemaOptions
* *
* @return Column * @return Column
*/ */
...@@ -423,7 +423,7 @@ class Column extends AbstractAsset ...@@ -423,7 +423,7 @@ class Column extends AbstractAsset
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getCustomSchemaOptions() public function getCustomSchemaOptions()
{ {
...@@ -431,7 +431,7 @@ class Column extends AbstractAsset ...@@ -431,7 +431,7 @@ class Column extends AbstractAsset
} }
/** /**
* @return array * @return mixed[]
*/ */
public function toArray() public function toArray()
{ {
......
...@@ -17,7 +17,7 @@ class ColumnDiff ...@@ -17,7 +17,7 @@ class ColumnDiff
/** @var Column */ /** @var Column */
public $column; public $column;
/** @var array */ /** @var string[] */
public $changedProperties = []; public $changedProperties = [];
/** @var Column */ /** @var Column */
......
...@@ -410,7 +410,7 @@ class Comparator ...@@ -410,7 +410,7 @@ class Comparator
* If there are differences this method returns $field2, otherwise the * If there are differences this method returns $field2, otherwise the
* boolean false. * boolean false.
* *
* @return array * @return string[]
*/ */
public function diffColumn(Column $column1, Column $column2) public function diffColumn(Column $column1, Column $column2)
{ {
......
...@@ -25,7 +25,7 @@ interface Constraint ...@@ -25,7 +25,7 @@ interface Constraint
* Returns the names of the referencing table columns * Returns the names of the referencing table columns
* the constraint is associated with. * the constraint is associated with.
* *
* @return array * @return string[]
*/ */
public function getColumns(); public function getColumns();
...@@ -39,7 +39,7 @@ interface Constraint ...@@ -39,7 +39,7 @@ interface Constraint
* *
* @param AbstractPlatform $platform The platform to use for quotation. * @param AbstractPlatform $platform The platform to use for quotation.
* *
* @return array * @return string[]
*/ */
public function getQuotedColumns(AbstractPlatform $platform); public function getQuotedColumns(AbstractPlatform $platform);
} }
...@@ -49,17 +49,21 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -49,17 +49,21 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
*/ */
protected $_foreignColumnNames; protected $_foreignColumnNames;
/** @var array Options associated with the foreign key constraint. */ /**
* Options associated with the foreign key constraint.
*
* @var mixed[]
*/
protected $_options; protected $_options;
/** /**
* Initializes the foreign key constraint. * Initializes the foreign key constraint.
* *
* @param array $localColumnNames Names of the referencing table columns. * @param string[] $localColumnNames Names of the referencing table columns.
* @param Table|string $foreignTableName Referenced table. * @param Table|string $foreignTableName Referenced table.
* @param array $foreignColumnNames Names of the referenced table columns. * @param string[] $foreignColumnNames Names of the referenced table columns.
* @param string|null $name Name of the foreign key constraint. * @param string|null $name Name of the foreign key constraint.
* @param array $options Options associated with the foreign key constraint. * @param mixed[] $options Options associated with the foreign key constraint.
*/ */
public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = []) public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = [])
{ {
...@@ -119,7 +123,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -119,7 +123,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* Returns the names of the referencing table columns * Returns the names of the referencing table columns
* the foreign key constraint is associated with. * the foreign key constraint is associated with.
* *
* @return array * @return string[]
*/ */
public function getLocalColumns() public function getLocalColumns()
{ {
...@@ -136,7 +140,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -136,7 +140,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* *
* @param AbstractPlatform $platform The platform to use for quotation. * @param AbstractPlatform $platform The platform to use for quotation.
* *
* @return array * @return string[]
*/ */
public function getQuotedLocalColumns(AbstractPlatform $platform) public function getQuotedLocalColumns(AbstractPlatform $platform)
{ {
...@@ -152,7 +156,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -152,7 +156,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
/** /**
* Returns unquoted representation of local table column names for comparison with other FK * Returns unquoted representation of local table column names for comparison with other FK
* *
* @return array * @return string[]
*/ */
public function getUnquotedLocalColumns() public function getUnquotedLocalColumns()
{ {
...@@ -162,7 +166,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -162,7 +166,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
/** /**
* Returns unquoted representation of foreign table column names for comparison with other FK * Returns unquoted representation of foreign table column names for comparison with other FK
* *
* @return array * @return string[]
*/ */
public function getUnquotedForeignColumns() public function getUnquotedForeignColumns()
{ {
...@@ -191,7 +195,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -191,7 +195,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* *
* @param AbstractPlatform $platform The platform to use for quotation. * @param AbstractPlatform $platform The platform to use for quotation.
* *
* @return array * @return string[]
*/ */
public function getQuotedColumns(AbstractPlatform $platform) public function getQuotedColumns(AbstractPlatform $platform)
{ {
...@@ -242,7 +246,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -242,7 +246,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* Returns the names of the referenced table columns * Returns the names of the referenced table columns
* the foreign key constraint is associated with. * the foreign key constraint is associated with.
* *
* @return array * @return string[]
*/ */
public function getForeignColumns() public function getForeignColumns()
{ {
...@@ -259,7 +263,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -259,7 +263,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
* *
* @param AbstractPlatform $platform The platform to use for quotation. * @param AbstractPlatform $platform The platform to use for quotation.
* *
* @return array * @return string[]
*/ */
public function getQuotedForeignColumns(AbstractPlatform $platform) public function getQuotedForeignColumns(AbstractPlatform $platform)
{ {
...@@ -300,7 +304,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint ...@@ -300,7 +304,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
/** /**
* Returns the options associated with the foreign key constraint. * Returns the options associated with the foreign key constraint.
* *
* @return array * @return mixed[]
*/ */
public function getOptions() public function getOptions()
{ {
......
...@@ -31,7 +31,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -31,7 +31,7 @@ class Index extends AbstractAsset implements Constraint
* Platform specific flags for indexes. * Platform specific flags for indexes.
* array($flagName => true) * array($flagName => true)
* *
* @var array * @var true[]
*/ */
protected $_flags = []; protected $_flags = [];
...@@ -39,7 +39,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -39,7 +39,7 @@ class Index extends AbstractAsset implements Constraint
* Platform specific options * Platform specific options
* *
* @todo $_flags should eventually be refactored into options * @todo $_flags should eventually be refactored into options
* @var array * @var mixed[]
*/ */
private $options = []; private $options = [];
...@@ -49,7 +49,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -49,7 +49,7 @@ class Index extends AbstractAsset implements Constraint
* @param bool $isUnique * @param bool $isUnique
* @param bool $isPrimary * @param bool $isPrimary
* @param string[] $flags * @param string[] $flags
* @param array $options * @param mixed[] $options
*/ */
public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = []) public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = [])
{ {
...@@ -157,7 +157,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -157,7 +157,7 @@ class Index extends AbstractAsset implements Constraint
/** /**
* Checks if this index exactly spans the given column names in the correct order. * Checks if this index exactly spans the given column names in the correct order.
* *
* @param array $columnNames * @param string[] $columnNames
* *
* @return bool * @return bool
*/ */
...@@ -304,7 +304,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -304,7 +304,7 @@ class Index extends AbstractAsset implements Constraint
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getOptions() public function getOptions()
{ {
......
...@@ -14,10 +14,11 @@ use function array_map; ...@@ -14,10 +14,11 @@ use function array_map;
use function array_shift; use function array_shift;
use function assert; use function assert;
use function explode; use function explode;
use function implode;
use function in_array; use function in_array;
use function join;
use function preg_match; use function preg_match;
use function preg_replace; use function preg_replace;
use function sprintf;
use function str_replace; use function str_replace;
use function stripos; use function stripos;
use function strlen; use function strlen;
...@@ -30,13 +31,13 @@ use function trim; ...@@ -30,13 +31,13 @@ use function trim;
*/ */
class PostgreSqlSchemaManager extends AbstractSchemaManager class PostgreSqlSchemaManager extends AbstractSchemaManager
{ {
/** @var array */ /** @var string[] */
private $existingSchemaPaths; private $existingSchemaPaths;
/** /**
* Gets all the existing schema names. * Gets all the existing schema names.
* *
* @return array * @return string[]
*/ */
public function getSchemaNames() public function getSchemaNames()
{ {
...@@ -50,7 +51,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -50,7 +51,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
* *
* This is a PostgreSQL only function. * This is a PostgreSQL only function.
* *
* @return array * @return string[]
*/ */
public function getSchemaSearchPaths() public function getSchemaSearchPaths()
{ {
...@@ -69,7 +70,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -69,7 +70,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
* *
* This is a PostgreSQL only function. * This is a PostgreSQL only function.
* *
* @return array * @return string[]
*/ */
public function getExistingSchemaSearchPaths() public function getExistingSchemaSearchPaths()
{ {
...@@ -213,9 +214,11 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -213,9 +214,11 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$buffer = []; $buffer = [];
foreach ($tableIndexes as $row) { foreach ($tableIndexes as $row) {
$colNumbers = array_map('intval', explode(' ', $row['indkey'])); $colNumbers = array_map('intval', explode(' ', $row['indkey']));
$colNumbersSql = 'IN (' . join(' ,', $colNumbers) . ' )'; $columnNameSql = sprintf(
$columnNameSql = "SELECT attnum, attname FROM pg_attribute 'SELECT attnum, attname FROM pg_attribute WHERE attrelid=%d AND attnum IN (%s) ORDER BY attnum ASC',
WHERE attrelid={$row['indrelid']} AND attnum $colNumbersSql ORDER BY attnum ASC;"; $row['indrelid'],
implode(' ,', $colNumbers)
);
$stmt = $this->_conn->executeQuery($columnNameSql); $stmt = $this->_conn->executeQuery($columnNameSql);
$indexColumns = $stmt->fetchAll(); $indexColumns = $stmt->fetchAll();
......
...@@ -254,7 +254,13 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -254,7 +254,13 @@ class SQLServerSchemaManager extends AbstractSchemaManager
foreach ($tableDiff->removedColumns as $col) { foreach ($tableDiff->removedColumns as $col) {
$columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName()); $columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName());
foreach ($this->_conn->fetchAll($columnConstraintSql) as $constraint) { foreach ($this->_conn->fetchAll($columnConstraintSql) as $constraint) {
$this->_conn->exec("ALTER TABLE $tableDiff->name DROP CONSTRAINT " . $constraint['Name']); $this->_conn->exec(
sprintf(
'ALTER TABLE %s DROP CONSTRAINT %s',
$tableDiff->name,
$constraint['Name']
)
);
} }
} }
} }
......
...@@ -42,7 +42,7 @@ class Schema extends AbstractAsset ...@@ -42,7 +42,7 @@ class Schema extends AbstractAsset
/** /**
* The namespaces in this schema. * The namespaces in this schema.
* *
* @var array * @var string[]
*/ */
private $namespaces = []; private $namespaces = [];
...@@ -58,7 +58,7 @@ class Schema extends AbstractAsset ...@@ -58,7 +58,7 @@ class Schema extends AbstractAsset
/** /**
* @param Table[] $tables * @param Table[] $tables
* @param Sequence[] $sequences * @param Sequence[] $sequences
* @param array $namespaces * @param string[] $namespaces
*/ */
public function __construct( public function __construct(
array $tables = [], array $tables = [],
...@@ -139,7 +139,7 @@ class Schema extends AbstractAsset ...@@ -139,7 +139,7 @@ class Schema extends AbstractAsset
/** /**
* Returns the namespaces of this schema. * Returns the namespaces of this schema.
* *
* @return array A list of namespace names. * @return string[] A list of namespace names.
*/ */
public function getNamespaces() public function getNamespaces()
{ {
...@@ -236,7 +236,7 @@ class Schema extends AbstractAsset ...@@ -236,7 +236,7 @@ class Schema extends AbstractAsset
/** /**
* Gets all table names, prefixed with a schema name, even the default one if present. * Gets all table names, prefixed with a schema name, even the default one if present.
* *
* @return array * @return string[]
*/ */
public function getTableNames() public function getTableNames()
{ {
...@@ -389,7 +389,7 @@ class Schema extends AbstractAsset ...@@ -389,7 +389,7 @@ class Schema extends AbstractAsset
/** /**
* Returns an array of necessary SQL queries to create the schema on the given platform. * Returns an array of necessary SQL queries to create the schema on the given platform.
* *
* @return array * @return string[]
*/ */
public function toSql(AbstractPlatform $platform) public function toSql(AbstractPlatform $platform)
{ {
...@@ -402,7 +402,7 @@ class Schema extends AbstractAsset ...@@ -402,7 +402,7 @@ class Schema extends AbstractAsset
/** /**
* Return an array of necessary SQL queries to drop the schema on the given platform. * Return an array of necessary SQL queries to drop the schema on the given platform.
* *
* @return array * @return string[]
*/ */
public function toDropSql(AbstractPlatform $platform) public function toDropSql(AbstractPlatform $platform)
{ {
...@@ -413,7 +413,7 @@ class Schema extends AbstractAsset ...@@ -413,7 +413,7 @@ class Schema extends AbstractAsset
} }
/** /**
* @return array * @return string[]
*/ */
public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform)
{ {
...@@ -424,7 +424,7 @@ class Schema extends AbstractAsset ...@@ -424,7 +424,7 @@ class Schema extends AbstractAsset
} }
/** /**
* @return array * @return string[]
*/ */
public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform) public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform)
{ {
......
...@@ -18,7 +18,7 @@ class SchemaConfig ...@@ -18,7 +18,7 @@ class SchemaConfig
/** @var string */ /** @var string */
protected $name; protected $name;
/** @var array */ /** @var mixed[] */
protected $defaultTableOptions = []; protected $defaultTableOptions = [];
/** /**
...@@ -83,7 +83,7 @@ class SchemaConfig ...@@ -83,7 +83,7 @@ class SchemaConfig
* Gets the default options that are passed to Table instances created with * Gets the default options that are passed to Table instances created with
* Schema#createTable(). * Schema#createTable().
* *
* @return array * @return mixed[]
*/ */
public function getDefaultTableOptions() public function getDefaultTableOptions()
{ {
...@@ -91,7 +91,7 @@ class SchemaConfig ...@@ -91,7 +91,7 @@ class SchemaConfig
} }
/** /**
* @param array $defaultTableOptions * @param mixed[] $defaultTableOptions
* *
* @return void * @return void
*/ */
......
...@@ -86,7 +86,7 @@ class SchemaDiff ...@@ -86,7 +86,7 @@ class SchemaDiff
* *
* This way it is ensured that assets are deleted which might not be relevant to the metadata schema at all. * This way it is ensured that assets are deleted which might not be relevant to the metadata schema at all.
* *
* @return array * @return string[]
*/ */
public function toSaveSql(AbstractPlatform $platform) public function toSaveSql(AbstractPlatform $platform)
{ {
...@@ -94,7 +94,7 @@ class SchemaDiff ...@@ -94,7 +94,7 @@ class SchemaDiff
} }
/** /**
* @return array * @return string[]
*/ */
public function toSql(AbstractPlatform $platform) public function toSql(AbstractPlatform $platform)
{ {
...@@ -104,7 +104,7 @@ class SchemaDiff ...@@ -104,7 +104,7 @@ class SchemaDiff
/** /**
* @param bool $saveMode * @param bool $saveMode
* *
* @return array * @return string[]
*/ */
protected function _toSql(AbstractPlatform $platform, $saveMode = false) protected function _toSql(AbstractPlatform $platform, $saveMode = false)
{ {
......
...@@ -37,7 +37,10 @@ class SchemaException extends DBALException ...@@ -37,7 +37,10 @@ class SchemaException extends DBALException
*/ */
public static function indexNameInvalid($indexName) public static function indexNameInvalid($indexName)
{ {
return new self("Invalid index-name $indexName given, has to be [a-zA-Z0-9_]", self::INDEX_INVALID_NAME); return new self(
sprintf('Invalid index-name %s given, has to be [a-zA-Z0-9_]', $indexName),
self::INDEX_INVALID_NAME
);
} }
/** /**
...@@ -48,7 +51,10 @@ class SchemaException extends DBALException ...@@ -48,7 +51,10 @@ class SchemaException extends DBALException
*/ */
public static function indexDoesNotExist($indexName, $table) public static function indexDoesNotExist($indexName, $table)
{ {
return new self("Index '$indexName' does not exist on table '$table'.", self::INDEX_DOESNT_EXIST); return new self(
sprintf("Index '%s' does not exist on table '%s'.", $indexName, $table),
self::INDEX_DOESNT_EXIST
);
} }
/** /**
...@@ -59,7 +65,10 @@ class SchemaException extends DBALException ...@@ -59,7 +65,10 @@ class SchemaException extends DBALException
*/ */
public static function indexAlreadyExists($indexName, $table) public static function indexAlreadyExists($indexName, $table)
{ {
return new self("An index with name '$indexName' was already defined on table '$table'.", self::INDEX_ALREADY_EXISTS); return new self(
sprintf("An index with name '%s' was already defined on table '%s'.", $indexName, $table),
self::INDEX_ALREADY_EXISTS
);
} }
/** /**
...@@ -70,7 +79,10 @@ class SchemaException extends DBALException ...@@ -70,7 +79,10 @@ class SchemaException extends DBALException
*/ */
public static function columnDoesNotExist($columnName, $table) public static function columnDoesNotExist($columnName, $table)
{ {
return new self("There is no column with name '$columnName' on table '$table'.", self::COLUMN_DOESNT_EXIST); return new self(
sprintf("There is no column with name '%s' on table '%s'.", $columnName, $table),
self::COLUMN_DOESNT_EXIST
);
} }
/** /**
...@@ -138,7 +150,10 @@ class SchemaException extends DBALException ...@@ -138,7 +150,10 @@ class SchemaException extends DBALException
*/ */
public static function foreignKeyDoesNotExist($fkName, $table) public static function foreignKeyDoesNotExist($fkName, $table)
{ {
return new self("There exists no foreign key with the name '$fkName' on table '$table'.", self::FOREIGNKEY_DOESNT_EXIST); return new self(
sprintf("There exists no foreign key with the name '%s' on table '%s'.", $fkName, $table),
self::FOREIGNKEY_DOESNT_EXIST
);
} }
/** /**
...@@ -161,6 +176,8 @@ class SchemaException extends DBALException ...@@ -161,6 +176,8 @@ class SchemaException extends DBALException
*/ */
public static function alterTableChangeNotSupported($changeName) public static function alterTableChangeNotSupported($changeName)
{ {
return new self("Alter table change not supported, given '$changeName'"); return new self(
sprintf("Alter table change not supported, given '%s'", $changeName)
);
} }
} }
...@@ -117,7 +117,12 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -117,7 +117,12 @@ class SqliteSchemaManager extends AbstractSchemaManager
$tableForeignKeys = $this->_conn->fetchAll($sql); $tableForeignKeys = $this->_conn->fetchAll($sql);
if (! empty($tableForeignKeys)) { if (! empty($tableForeignKeys)) {
$createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); $createSql = $this->_conn->fetchAll(
sprintf(
"SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '%s'",
$table
)
);
$createSql = $createSql[0]['sql'] ?? ''; $createSql = $createSql[0]['sql'] ?? '';
if (preg_match_all( if (preg_match_all(
...@@ -169,7 +174,9 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -169,7 +174,9 @@ class SqliteSchemaManager extends AbstractSchemaManager
$indexBuffer = []; $indexBuffer = [];
// fetch primary // fetch primary
$stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')"); $stmt = $this->_conn->executeQuery(
sprintf("PRAGMA TABLE_INFO ('%s')", $tableName)
);
$indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE); $indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE);
usort($indexArray, static function ($a, $b) { usort($indexArray, static function ($a, $b) {
...@@ -205,7 +212,9 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -205,7 +212,9 @@ class SqliteSchemaManager extends AbstractSchemaManager
$idx['primary'] = false; $idx['primary'] = false;
$idx['non_unique'] = $tableIndex['unique']?false:true; $idx['non_unique'] = $tableIndex['unique']?false:true;
$stmt = $this->_conn->executeQuery("PRAGMA INDEX_INFO ('{$keyName}')"); $stmt = $this->_conn->executeQuery(
sprintf("PRAGMA INDEX_INFO ('%s')", $keyName)
);
$indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE); $indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE);
foreach ($indexArray as $indexColumnRow) { foreach ($indexArray as $indexColumnRow) {
...@@ -263,7 +272,12 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -263,7 +272,12 @@ class SqliteSchemaManager extends AbstractSchemaManager
} }
// inspect column collation and comments // inspect column collation and comments
$createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); $createSql = $this->_conn->fetchAll(
sprintf(
"SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '%s'",
$table
)
);
$createSql = $createSql[0]['sql'] ?? ''; $createSql = $createSql[0]['sql'] ?? '';
foreach ($list as $columnName => $column) { foreach ($list as $columnName => $column) {
......
...@@ -19,7 +19,7 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer ...@@ -19,7 +19,7 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer
} }
/** /**
* @param array $sql * @param string[] $sql
*/ */
protected function processSqlSafely(array $sql) protected function processSqlSafely(array $sql)
{ {
...@@ -32,7 +32,7 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer ...@@ -32,7 +32,7 @@ abstract class AbstractSchemaSynchronizer implements SchemaSynchronizer
} }
/** /**
* @param array $sql * @param string[] $sql
*/ */
protected function processSql(array $sql) protected function processSql(array $sql)
{ {
......
...@@ -13,39 +13,39 @@ interface SchemaSynchronizer ...@@ -13,39 +13,39 @@ interface SchemaSynchronizer
/** /**
* Gets the SQL statements that can be executed to create the schema. * Gets the SQL statements that can be executed to create the schema.
* *
* @return array * @return string[]
*/ */
function getCreateSchema(Schema $createSchema); public function getCreateSchema(Schema $createSchema);
/** /**
* Gets the SQL Statements to update given schema with the underlying db. * Gets the SQL Statements to update given schema with the underlying db.
* *
* @param bool $noDrops * @param bool $noDrops
* *
* @return array * @return string[]
*/ */
function getUpdateSchema(Schema $toSchema, $noDrops = false); public function getUpdateSchema(Schema $toSchema, $noDrops = false);
/** /**
* Gets the SQL Statements to drop the given schema from underlying db. * Gets the SQL Statements to drop the given schema from underlying db.
* *
* @return array * @return string[]
*/ */
function getDropSchema(Schema $dropSchema); public function getDropSchema(Schema $dropSchema);
/** /**
* Gets the SQL statements to drop all schema assets from underlying db. * Gets the SQL statements to drop all schema assets from underlying db.
* *
* @return array * @return string[]
*/ */
function getDropAllSchema(); public function getDropAllSchema();
/** /**
* Creates the Schema. * Creates the Schema.
* *
* @return void * @return void
*/ */
function createSchema(Schema $createSchema); public function createSchema(Schema $createSchema);
/** /**
* Updates the Schema to new schema version. * Updates the Schema to new schema version.
...@@ -54,19 +54,19 @@ interface SchemaSynchronizer ...@@ -54,19 +54,19 @@ interface SchemaSynchronizer
* *
* @return void * @return void
*/ */
function updateSchema(Schema $toSchema, $noDrops = false); public function updateSchema(Schema $toSchema, $noDrops = false);
/** /**
* Drops the given database schema from the underlying db. * Drops the given database schema from the underlying db.
* *
* @return void * @return void
*/ */
function dropSchema(Schema $dropSchema); public function dropSchema(Schema $dropSchema);
/** /**
* Drops all assets from the underlying db. * Drops all assets from the underlying db.
* *
* @return void * @return void
*/ */
function dropAllSchema(); public function dropAllSchema();
} }
...@@ -40,7 +40,7 @@ class Table extends AbstractAsset ...@@ -40,7 +40,7 @@ class Table extends AbstractAsset
/** @var ForeignKeyConstraint[] */ /** @var ForeignKeyConstraint[] */
protected $_fkConstraints = []; protected $_fkConstraints = [];
/** @var array */ /** @var mixed[] */
protected $_options = []; protected $_options = [];
/** @var SchemaConfig|null */ /** @var SchemaConfig|null */
...@@ -52,7 +52,7 @@ class Table extends AbstractAsset ...@@ -52,7 +52,7 @@ class Table extends AbstractAsset
* @param Index[] $indexes * @param Index[] $indexes
* @param ForeignKeyConstraint[] $fkConstraints * @param ForeignKeyConstraint[] $fkConstraints
* @param int $idGeneratorType * @param int $idGeneratorType
* @param array $options * @param mixed[] $options
* *
* @throws DBALException * @throws DBALException
*/ */
...@@ -102,7 +102,7 @@ class Table extends AbstractAsset ...@@ -102,7 +102,7 @@ class Table extends AbstractAsset
/** /**
* Sets the Primary Key. * Sets the Primary Key.
* *
* @param array $columns * @param mixed[][] $columns
* @param string|bool $indexName * @param string|bool $indexName
* *
* @return self * @return self
...@@ -120,10 +120,10 @@ class Table extends AbstractAsset ...@@ -120,10 +120,10 @@ class Table extends AbstractAsset
} }
/** /**
* @param array $columnNames * @param mixed[][] $columnNames
* @param string|null $indexName * @param string|null $indexName
* @param array $flags * @param string[] $flags
* @param array $options * @param mixed[] $options
* *
* @return self * @return self
*/ */
...@@ -170,9 +170,9 @@ class Table extends AbstractAsset ...@@ -170,9 +170,9 @@ class Table extends AbstractAsset
} }
/** /**
* @param array $columnNames * @param mixed[][] $columnNames
* @param string|null $indexName * @param string|null $indexName
* @param array $options * @param mixed[] $options
* *
* @return self * @return self
*/ */
...@@ -198,7 +198,7 @@ class Table extends AbstractAsset ...@@ -198,7 +198,7 @@ class Table extends AbstractAsset
* *
* @return self This table instance. * @return self This table instance.
* *
* @throws SchemaException if no index exists for the given current name * @throws SchemaException If no index exists for the given current name
* or if an index with the given new name already exists on this table. * or if an index with the given new name already exists on this table.
*/ */
public function renameIndex($oldIndexName, $newIndexName = null) public function renameIndex($oldIndexName, $newIndexName = null)
...@@ -238,7 +238,7 @@ class Table extends AbstractAsset ...@@ -238,7 +238,7 @@ class Table extends AbstractAsset
/** /**
* Checks if an index begins in the order of the given columns. * Checks if an index begins in the order of the given columns.
* *
* @param array $columnsNames * @param mixed[][] $columnsNames
* *
* @return bool * @return bool
*/ */
...@@ -255,12 +255,12 @@ class Table extends AbstractAsset ...@@ -255,12 +255,12 @@ class Table extends AbstractAsset
} }
/** /**
* @param array $columnNames * @param mixed[][] $columnNames
* @param string $indexName * @param string $indexName
* @param bool $isUnique * @param bool $isUnique
* @param bool $isPrimary * @param bool $isPrimary
* @param array $flags * @param string[] $flags
* @param array $options * @param mixed[] $options
* *
* @return Index * @return Index
* *
...@@ -288,7 +288,7 @@ class Table extends AbstractAsset ...@@ -288,7 +288,7 @@ class Table extends AbstractAsset
/** /**
* @param string $columnName * @param string $columnName
* @param string $typeName * @param string $typeName
* @param array $options * @param mixed[] $options
* *
* @return Column * @return Column
*/ */
...@@ -322,7 +322,7 @@ class Table extends AbstractAsset ...@@ -322,7 +322,7 @@ class Table extends AbstractAsset
* Change Column Details. * Change Column Details.
* *
* @param string $columnName * @param string $columnName
* @param array $options * @param mixed[] $options
* *
* @return self * @return self
*/ */
...@@ -355,9 +355,9 @@ class Table extends AbstractAsset ...@@ -355,9 +355,9 @@ class Table extends AbstractAsset
* Name is inferred from the local columns. * Name is inferred from the local columns.
* *
* @param Table|string $foreignTable Table schema instance or table name * @param Table|string $foreignTable Table schema instance or table name
* @param array $localColumnNames * @param string[] $localColumnNames
* @param array $foreignColumnNames * @param string[] $foreignColumnNames
* @param array $options * @param mixed[] $options
* @param string|null $constraintName * @param string|null $constraintName
* *
* @return self * @return self
...@@ -377,9 +377,9 @@ class Table extends AbstractAsset ...@@ -377,9 +377,9 @@ class Table extends AbstractAsset
* @deprecated Use {@link addForeignKeyConstraint} * @deprecated Use {@link addForeignKeyConstraint}
* *
* @param Table|string $foreignTable Table schema instance or table name * @param Table|string $foreignTable Table schema instance or table name
* @param array $localColumnNames * @param string[] $localColumnNames
* @param array $foreignColumnNames * @param string[] $foreignColumnNames
* @param array $options * @param mixed[] $options
* *
* @return self * @return self
*/ */
...@@ -395,9 +395,9 @@ class Table extends AbstractAsset ...@@ -395,9 +395,9 @@ class Table extends AbstractAsset
* *
* @param string $name * @param string $name
* @param Table|string $foreignTable Table schema instance or table name * @param Table|string $foreignTable Table schema instance or table name
* @param array $localColumnNames * @param string[] $localColumnNames
* @param array $foreignColumnNames * @param string[] $foreignColumnNames
* @param array $options * @param mixed[] $options
* *
* @return self * @return self
* *
...@@ -626,7 +626,7 @@ class Table extends AbstractAsset ...@@ -626,7 +626,7 @@ class Table extends AbstractAsset
/** /**
* Returns only columns that have specified names * Returns only columns that have specified names
* *
* @param array $columnNames * @param string[] $columnNames
* *
* @return Column[] * @return Column[]
*/ */
...@@ -687,7 +687,7 @@ class Table extends AbstractAsset ...@@ -687,7 +687,7 @@ class Table extends AbstractAsset
/** /**
* Returns the primary key columns. * Returns the primary key columns.
* *
* @return array * @return string[]
* *
* @throws DBALException * @throws DBALException
*/ */
...@@ -781,7 +781,7 @@ class Table extends AbstractAsset ...@@ -781,7 +781,7 @@ class Table extends AbstractAsset
} }
/** /**
* @return array * @return mixed[]
*/ */
public function getOptions() public function getOptions()
{ {
......
...@@ -10,16 +10,16 @@ use function array_merge; ...@@ -10,16 +10,16 @@ use function array_merge;
class CreateSchemaSqlCollector extends AbstractVisitor class CreateSchemaSqlCollector extends AbstractVisitor
{ {
/** @var array */ /** @var string[] */
private $createNamespaceQueries = []; private $createNamespaceQueries = [];
/** @var array */ /** @var string[] */
private $createTableQueries = []; private $createTableQueries = [];
/** @var array */ /** @var string[] */
private $createSequenceQueries = []; private $createSequenceQueries = [];
/** @var array */ /** @var string[] */
private $createFkConstraintQueries = []; private $createFkConstraintQueries = [];
/** @var AbstractPlatform */ /** @var AbstractPlatform */
...@@ -84,7 +84,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor ...@@ -84,7 +84,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
/** /**
* Gets all queries collected so far. * Gets all queries collected so far.
* *
* @return array * @return string[]
*/ */
public function getQueries() public function getQueries()
{ {
......
...@@ -74,7 +74,7 @@ class DropSchemaSqlCollector extends AbstractVisitor ...@@ -74,7 +74,7 @@ class DropSchemaSqlCollector extends AbstractVisitor
} }
/** /**
* @return array * @return string[]
*/ */
public function getQueries() public function getQueries()
{ {
......
...@@ -97,7 +97,7 @@ class Graphviz extends AbstractVisitor ...@@ -97,7 +97,7 @@ class Graphviz extends AbstractVisitor
/** /**
* @param string $name * @param string $name
* @param array $options * @param string[] $options
* *
* @return string * @return string
*/ */
...@@ -115,7 +115,7 @@ class Graphviz extends AbstractVisitor ...@@ -115,7 +115,7 @@ class Graphviz extends AbstractVisitor
/** /**
* @param string $node1 * @param string $node1
* @param string $node2 * @param string $node2
* @param array $options * @param string[] $options
* *
* @return string * @return string
*/ */
......
...@@ -17,25 +17,25 @@ interface SchemaDiffVisitor ...@@ -17,25 +17,25 @@ interface SchemaDiffVisitor
/** /**
* Visit an orphaned foreign key whose table was deleted. * Visit an orphaned foreign key whose table was deleted.
*/ */
function visitOrphanedForeignKey(ForeignKeyConstraint $foreignKey); public function visitOrphanedForeignKey(ForeignKeyConstraint $foreignKey);
/** /**
* Visit a sequence that has changed. * Visit a sequence that has changed.
*/ */
function visitChangedSequence(Sequence $sequence); public function visitChangedSequence(Sequence $sequence);
/** /**
* Visit a sequence that has been removed. * Visit a sequence that has been removed.
*/ */
function visitRemovedSequence(Sequence $sequence); public function visitRemovedSequence(Sequence $sequence);
function visitNewSequence(Sequence $sequence); public function visitNewSequence(Sequence $sequence);
function visitNewTable(Table $table); public function visitNewTable(Table $table);
function visitNewTableForeignKey(Table $table, ForeignKeyConstraint $foreignKey); public function visitNewTableForeignKey(Table $table, ForeignKeyConstraint $foreignKey);
function visitRemovedTable(Table $table); public function visitRemovedTable(Table $table);
function visitChangedTable(TableDiff $tableDiff); public function visitChangedTable(TableDiff $tableDiff);
} }
...@@ -60,7 +60,7 @@ class PoolingShardConnection extends Connection ...@@ -60,7 +60,7 @@ class PoolingShardConnection extends Connection
private $connectionParameters = []; private $connectionParameters = [];
/** /**
* @param array $params * {@inheritDoc}
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
......
...@@ -69,11 +69,7 @@ class PoolingShardManager implements ShardManager ...@@ -69,11 +69,7 @@ class PoolingShardManager implements ShardManager
} }
/** /**
* @param string $sql * {@inheritDoc}
* @param array $params
* @param array $types
*
* @return array
* *
* @throws RuntimeException * @throws RuntimeException
*/ */
......
...@@ -153,7 +153,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer ...@@ -153,7 +153,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
} }
/** /**
* @return array * @return Schema[]
*/ */
private function partitionSchema(Schema $schema) private function partitionSchema(Schema $schema)
{ {
...@@ -199,7 +199,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer ...@@ -199,7 +199,7 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
* perform the given operation on the underlying schema synchronizer given * perform the given operation on the underlying schema synchronizer given
* the different partitioned schema instances. * the different partitioned schema instances.
* *
* @return array * @return string[]
*/ */
private function work(Schema $schema, Closure $operation) private function work(Schema $schema, Closure $operation)
{ {
......
...@@ -33,7 +33,7 @@ use function in_array; ...@@ -33,7 +33,7 @@ use function in_array;
*/ */
class MultiTenantVisitor implements Visitor class MultiTenantVisitor implements Visitor
{ {
/** @var array */ /** @var string[] */
private $excludedTables = []; private $excludedTables = [];
/** @var string */ /** @var string */
...@@ -51,7 +51,7 @@ class MultiTenantVisitor implements Visitor ...@@ -51,7 +51,7 @@ class MultiTenantVisitor implements Visitor
private $distributionName; private $distributionName;
/** /**
* @param array $excludedTables * @param string[] $excludedTables
* @param string $tenantColumnName * @param string $tenantColumnName
* @param string|null $distributionName * @param string|null $distributionName
*/ */
......
...@@ -17,5 +17,5 @@ interface ShardChoser ...@@ -17,5 +17,5 @@ interface ShardChoser
* *
* @return string|int * @return string|int
*/ */
function pickShard($distributionValue, PoolingShardConnection $conn); public function pickShard($distributionValue, PoolingShardConnection $conn);
} }
...@@ -28,7 +28,7 @@ interface ShardManager ...@@ -28,7 +28,7 @@ interface ShardManager
* *
* @return void * @return void
*/ */
function selectGlobal(); public function selectGlobal();
/** /**
* Selects the shard against which the queries after this statement will be issued. * Selects the shard against which the queries after this statement will be issued.
...@@ -39,14 +39,14 @@ interface ShardManager ...@@ -39,14 +39,14 @@ interface ShardManager
* *
* @throws ShardingException If no value is passed as shard identifier. * @throws ShardingException If no value is passed as shard identifier.
*/ */
function selectShard($distributionValue); public function selectShard($distributionValue);
/** /**
* Gets the distribution value currently used for sharding. * Gets the distribution value currently used for sharding.
* *
* @return string|null * @return string|null
*/ */
function getCurrentDistributionValue(); public function getCurrentDistributionValue();
/** /**
* Gets information about the amount of shards and other details. * Gets information about the amount of shards and other details.
...@@ -54,9 +54,9 @@ interface ShardManager ...@@ -54,9 +54,9 @@ interface ShardManager
* Format is implementation specific, each shard is one element and has an * Format is implementation specific, each shard is one element and has an
* 'id' attribute at least. * 'id' attribute at least.
* *
* @return array * @return mixed[][]
*/ */
function getShards(); public function getShards();
/** /**
* Queries all shards in undefined order and return the results appended to * Queries all shards in undefined order and return the results appended to
...@@ -65,10 +65,10 @@ interface ShardManager ...@@ -65,10 +65,10 @@ interface ShardManager
* Using {@link \Doctrine\DBAL\Connection::fetchAll} to retrieve rows internally. * Using {@link \Doctrine\DBAL\Connection::fetchAll} to retrieve rows internally.
* *
* @param string $sql * @param string $sql
* @param array $params * @param mixed[] $params
* @param array $types * @param int[]|string[] $types
* *
* @return array * @return mixed[]
*/ */
function queryAll($sql, array $params, array $types); public function queryAll($sql, array $params, array $types);
} }
...@@ -27,14 +27,14 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -27,14 +27,14 @@ class Statement implements IteratorAggregate, DriverStatement
/** /**
* The bound parameters. * The bound parameters.
* *
* @var array * @var mixed[]
*/ */
protected $params = []; protected $params = [];
/** /**
* The parameter types. * The parameter types.
* *
* @var array * @var int[]|string[]
*/ */
protected $types = []; protected $types = [];
...@@ -132,7 +132,7 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -132,7 +132,7 @@ class Statement implements IteratorAggregate, DriverStatement
/** /**
* Executes the statement with the currently bound parameters. * Executes the statement with the currently bound parameters.
* *
* @param array|null $params * @param mixed[]|null $params
* *
* @return bool TRUE on success, FALSE on failure. * @return bool TRUE on success, FALSE on failure.
* *
...@@ -203,9 +203,7 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -203,9 +203,7 @@ class Statement implements IteratorAggregate, DriverStatement
} }
/** /**
* Fetches extended error information associated with the last operation on the statement. * {@inheritDoc}
*
* @return array
*/ */
public function errorInfo() public function errorInfo()
{ {
...@@ -257,11 +255,7 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -257,11 +255,7 @@ class Statement implements IteratorAggregate, DriverStatement
} }
/** /**
* Returns a single column from the next row of a result set. * {@inheritDoc}
*
* @param int $columnIndex
*
* @return mixed A single column from the next row of a result set or FALSE if there are no more rows.
*/ */
public function fetchColumn($columnIndex = 0) public function fetchColumn($columnIndex = 0)
{ {
......
...@@ -56,8 +56,10 @@ EOT ...@@ -56,8 +56,10 @@ EOT
{ {
$conn = $this->getHelper('db')->getConnection(); $conn = $this->getHelper('db')->getConnection();
if (($fileNames = $input->getArgument('file')) === null) { $fileNames = $input->getArgument('file');
return;
if ($fileNames === null) {
return null;
} }
foreach ((array) $fileNames as $fileName) { foreach ((array) $fileNames as $fileName) {
...@@ -123,5 +125,7 @@ EOT ...@@ -123,5 +125,7 @@ EOT
$stmt->closeCursor(); $stmt->closeCursor();
} }
} }
return null;
} }
} }
...@@ -16,7 +16,7 @@ use function implode; ...@@ -16,7 +16,7 @@ use function implode;
class ReservedWordsCommand extends Command class ReservedWordsCommand extends Command
{ {
/** @var array */ /** @var string[] */
private $keywordListClasses = [ private $keywordListClasses = [
'mysql' => 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords', 'mysql' => 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords',
'mysql57' => 'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords', 'mysql57' => 'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords',
......
...@@ -47,7 +47,9 @@ EOT ...@@ -47,7 +47,9 @@ EOT
{ {
$conn = $this->getHelper('db')->getConnection(); $conn = $this->getHelper('db')->getConnection();
if (($sql = $input->getArgument('sql')) === null) { $sql = $input->getArgument('sql');
if ($sql === null) {
throw new RuntimeException("Argument 'SQL' is required in order to execute this command correctly."); throw new RuntimeException("Argument 'SQL' is required in order to execute this command correctly.");
} }
......
...@@ -45,14 +45,14 @@ abstract class Type ...@@ -45,14 +45,14 @@ abstract class Type
/** /**
* Map of already instantiated type objects. One instance per type (flyweight). * Map of already instantiated type objects. One instance per type (flyweight).
* *
* @var array * @var self[]
*/ */
private static $_typeObjects = []; private static $_typeObjects = [];
/** /**
* The map of supported doctrine mapping types. * The map of supported doctrine mapping types.
* *
* @var array * @var string[]
*/ */
private static $_typesMap = [ private static $_typesMap = [
self::TARRAY => ArrayType::class, self::TARRAY => ArrayType::class,
...@@ -132,7 +132,7 @@ abstract class Type ...@@ -132,7 +132,7 @@ abstract class Type
/** /**
* Gets the SQL declaration snippet for a field of this type. * Gets the SQL declaration snippet for a field of this type.
* *
* @param array $fieldDeclaration The field declaration. * @param mixed[] $fieldDeclaration The field declaration.
* @param AbstractPlatform $platform The currently used database platform. * @param AbstractPlatform $platform The currently used database platform.
* *
* @return string * @return string
...@@ -241,7 +241,7 @@ abstract class Type ...@@ -241,7 +241,7 @@ abstract class Type
* Gets the types array map which holds all registered types and the corresponding * Gets the types array map which holds all registered types and the corresponding
* type class * type class
* *
* @return array * @return string[]
*/ */
public static function getTypesMap() public static function getTypesMap()
{ {
...@@ -303,7 +303,7 @@ abstract class Type ...@@ -303,7 +303,7 @@ abstract class Type
/** /**
* Gets an array of database types that map to this Doctrine type. * Gets an array of database types that map to this Doctrine type.
* *
* @return array * @return string[]
*/ */
public function getMappedDatabaseTypes(AbstractPlatform $platform) public function getMappedDatabaseTypes(AbstractPlatform $platform)
{ {
......
...@@ -24,7 +24,7 @@ interface VersionAwarePlatformDriver ...@@ -24,7 +24,7 @@ interface VersionAwarePlatformDriver
* *
* @return AbstractPlatform * @return AbstractPlatform
* *
* @throws DBALException if the given version string could not be evaluated. * @throws DBALException If the given version string could not be evaluated.
*/ */
public function createDatabasePlatformForVersion($version); public function createDatabasePlatformForVersion($version);
} }
...@@ -37,8 +37,25 @@ ...@@ -37,8 +37,25 @@
<exclude-pattern>tests/Doctrine/Tests/DBAL/Tools/TestAsset/*</exclude-pattern> <exclude-pattern>tests/Doctrine/Tests/DBAL/Tools/TestAsset/*</exclude-pattern>
</rule> </rule>
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/2099 -->
<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
<exclude-pattern>lib/Doctrine/DBAL/Platforms/AbstractPlatform.php</exclude-pattern>
<exclude-pattern>lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php</exclude-pattern>
</rule>
<!-- some statement classes close cursor using an empty while-loop -->
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedWhile">
<exclude-pattern>lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php</exclude-pattern>
</rule>
<!-- sqlsrv functions are documented in upper case but reflected in lower case -->
<rule ref="Squiz.PHP.LowercasePHPFunctions.CallUppercase">
<exclude-pattern>lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php</exclude-pattern>
</rule>
<!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/2165 --> <!-- see https://github.com/squizlabs/PHP_CodeSniffer/issues/2165 -->
<rule ref="Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma"> <rule ref="Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma">
<exclude-pattern>tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php</exclude-pattern> <exclude-pattern>tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php</exclude-pattern>
</rule> </rule>
</ruleset> </ruleset>
...@@ -781,42 +781,51 @@ EOD; ...@@ -781,42 +781,51 @@ EOD;
return [ return [
[ [
null, null,
"SELECT c.*, <<<'SQL'
SELECT c.*,
( (
SELECT d.comments SELECT d.comments
FROM user_col_comments d FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments ) AS comments
FROM user_tab_columns c FROM user_tab_columns c
WHERE c.table_name = 'test' WHERE c.table_name = 'test'
ORDER BY c.column_id", ORDER BY c.column_id
SQL
,
], ],
[ [
'/', '/',
"SELECT c.*, <<<'SQL'
SELECT c.*,
( (
SELECT d.comments SELECT d.comments
FROM user_col_comments d FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments ) AS comments
FROM user_tab_columns c FROM user_tab_columns c
WHERE c.table_name = 'test' WHERE c.table_name = 'test'
ORDER BY c.column_id", ORDER BY c.column_id
SQL
,
], ],
[ [
'scott', 'scott',
"SELECT c.*, <<<'SQL'
SELECT c.*,
( (
SELECT d.comments SELECT d.comments
FROM all_col_comments d FROM all_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME AND d.OWNER = c.OWNER WHERE d.TABLE_NAME = c.TABLE_NAME AND d.OWNER = c.OWNER
AND d.COLUMN_NAME = c.COLUMN_NAME AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments ) AS comments
FROM all_tab_columns c FROM all_tab_columns c
WHERE c.table_name = 'test' AND c.owner = 'SCOTT' WHERE c.table_name = 'test' AND c.owner = 'SCOTT'
ORDER BY c.column_id", ORDER BY c.column_id
SQL
,
], ],
]; ];
} }
......
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