Commit 26d35871 authored by Ahmed Abdou's avatar Ahmed Abdou

Upgrade doctrine cs to 6.0

parent 5b5c2c93
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "dc19a584f29861609d085123b65f3961",
"content-hash": "ddba260b7dfb84d2591b0a71a885166a",
"packages": [
{
"name": "doctrine/cache",
......@@ -202,29 +202,27 @@
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.4.4",
"version": "v0.5.0",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08"
"reference": "e749410375ff6fb7a040a68878c656c2e610b132"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
"reference": "e749410375ff6fb7a040a68878c656c2e610b132",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0",
"php": "^5.3|^7",
"squizlabs/php_codesniffer": "*"
"squizlabs/php_codesniffer": "^2|^3"
},
"require-dev": {
"composer/composer": "*",
"wimg/php-compatibility": "^8.0"
},
"suggest": {
"dealerdirect/qa-tools": "All the PHP QA tools you'll need"
"phpcompatibility/php-compatibility": "^9.0",
"sensiolabs/security-checker": "^4.1.0"
},
"type": "composer-plugin",
"extra": {
......@@ -242,13 +240,13 @@
"authors": [
{
"name": "Franck Nijhof",
"email": "f.nijhof@dealerdirect.nl",
"homepage": "http://workingatdealerdirect.eu",
"role": "Developer"
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://workingatdealerdirect.eu",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
......@@ -266,32 +264,32 @@
"stylecheck",
"tests"
],
"time": "2017-12-06T16:27:17+00:00"
"time": "2018-10-26T13:21:45+00:00"
},
{
"name": "doctrine/coding-standard",
"version": "5.0.0",
"version": "6.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/coding-standard.git",
"reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c"
"reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/bb8de042a25c4fb59a2c55c350dc55cc00227a8c",
"reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/d33f69eb98b25aa51ffe3a909f0ec77000af4701",
"reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"php": "^7.1",
"slevomat/coding-standard": "^4.8.0",
"squizlabs/php_codesniffer": "^3.3.2"
"slevomat/coding-standard": "^5.0",
"squizlabs/php_codesniffer": "^3.4.0"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "5.0.x-dev"
"dev-master": "6.0.x-dev"
}
},
"autoload": {
......@@ -327,7 +325,7 @@
"standard",
"style"
],
"time": "2018-09-24T19:08:56+00:00"
"time": "2019-03-15T12:45:47+00:00"
},
{
"name": "doctrine/instantiator",
......@@ -2486,29 +2484,30 @@
},
{
"name": "slevomat/coding-standard",
"version": "4.8.3",
"version": "5.0.2",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "32e1ca205fc34920f323582ed29c0602e3897ae3"
"reference": "223f02b6193fe47b7b483bfa5bf75693535482dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/32e1ca205fc34920f323582ed29c0602e3897ae3",
"reference": "32e1ca205fc34920f323582ed29c0602e3897ae3",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/223f02b6193fe47b7b483bfa5bf75693535482dd",
"reference": "223f02b6193fe47b7b483bfa5bf75693535482dd",
"shasum": ""
},
"require": {
"php": "^7.1",
"squizlabs/php_codesniffer": "^3.3.0"
"phpstan/phpdoc-parser": "^0.3.1",
"squizlabs/php_codesniffer": "^3.4.0"
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "1.0.0",
"phing/phing": "2.16.1",
"phpstan/phpstan": "0.9.2",
"phpstan/phpstan-phpunit": "0.9.4",
"phpstan/phpstan-strict-rules": "0.9",
"phpunit/phpunit": "7.3.5"
"phpstan/phpstan": "0.11.1",
"phpstan/phpstan-phpunit": "0.11",
"phpstan/phpstan-strict-rules": "0.11",
"phpunit/phpunit": "8.0.0"
},
"type": "phpcodesniffer-standard",
"autoload": {
......@@ -2521,20 +2520,20 @@
"MIT"
],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
"time": "2018-09-25T21:21:11+00:00"
"time": "2019-03-12T20:26:36+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.3.2",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
"reference": "379deb987e26c7cd103a7b387aea178baec96e48"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
"reference": "379deb987e26c7cd103a7b387aea178baec96e48",
"shasum": ""
},
"require": {
......@@ -2572,7 +2571,7 @@
"phpcs",
"standards"
],
"time": "2018-09-23T23:08:17+00:00"
"time": "2018-12-19T23:57:18+00:00"
},
{
"name": "symfony/console",
......
......@@ -107,6 +107,7 @@ class Configuration
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return preg_match($filterExpression, $assetName);
};
}
......@@ -116,7 +117,8 @@ class Configuration
*/
public function setSchemaAssetsFilter(?callable $callable = null) : ?callable
{
$this->_attributes['filterSchemaAssetsExpression'] = null;
$this->_attributes['filterSchemaAssetsExpression'] = null;
return $this->_attributes['filterSchemaAssetsExpressionCallable'] = $callable;
}
......
......@@ -1161,6 +1161,7 @@ class Connection implements DriverConnection
try {
$res = $func($this);
$this->commit();
return $res;
} catch (Exception $e) {
$this->rollBack();
......
......@@ -36,34 +36,28 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
return new Exception\LockWaitTimeoutException($message, $exception);
case '1050':
return new Exception\TableExistsException($message, $exception);
case '1051':
case '1146':
return new Exception\TableNotFoundException($message, $exception);
case '1216':
case '1217':
case '1451':
case '1452':
case '1701':
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case '1062':
case '1557':
case '1569':
case '1586':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '1054':
case '1166':
case '1611':
return new Exception\InvalidFieldNameException($message, $exception);
case '1052':
case '1060':
case '1110':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '1064':
case '1149':
case '1287':
......@@ -77,7 +71,6 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case '1554':
case '1626':
return new Exception\SyntaxErrorException($message, $exception);
case '1044':
case '1045':
case '1046':
......@@ -91,7 +84,6 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case '2002':
case '2005':
return new Exception\ConnectionException($message, $exception);
case '1048':
case '1121':
case '1138':
......
......@@ -24,30 +24,22 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
case '2299':
case '38911':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '904':
return new Exception\InvalidFieldNameException($message, $exception);
case '918':
case '960':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '923':
return new Exception\SyntaxErrorException($message, $exception);
case '942':
return new Exception\TableNotFoundException($message, $exception);
case '955':
return new Exception\TableExistsException($message, $exception);
case '1017':
case '12545':
return new Exception\ConnectionException($message, $exception);
case '1400':
return new Exception\NotNullConstraintViolationException($message, $exception);
case '2266':
case '2291':
case '2292':
......
......@@ -43,28 +43,20 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
break;
case '23502':
return new Exception\NotNullConstraintViolationException($message, $exception);
case '23503':
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case '23505':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '42601':
return new Exception\SyntaxErrorException($message, $exception);
case '42702':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '42703':
return new Exception\InvalidFieldNameException($message, $exception);
case '42P01':
return new Exception\TableNotFoundException($message, $exception);
case '42P07':
return new Exception\TableExistsException($message, $exception);
case '7':
// In some case (mainly connection errors) the PDO exception does not provide a SQLSTATE via its code.
// The exception code is always set to 7 here.
......
......@@ -261,13 +261,10 @@ class DB2Statement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::COLUMN:
return $this->fetchColumn();
case FetchMode::MIXED:
return db2_fetch_both($this->stmt);
case FetchMode::ASSOCIATIVE:
return db2_fetch_assoc($this->stmt);
case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs;
......@@ -285,13 +282,10 @@ class DB2Statement implements IteratorAggregate, Statement
}
return $result;
case FetchMode::NUMERIC:
return db2_fetch_array($this->stmt);
case FetchMode::STANDARD_OBJECT:
return db2_fetch_object($this->stmt);
default:
throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.');
}
......
......@@ -57,7 +57,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$socket = $params['unix_socket'] ?? ini_get('mysqli.default_socket');
$dbname = $params['dbname'] ?? null;
$flags = $driverOptions[static::OPTION_FLAGS] ?? null;
$flags = $driverOptions[self::OPTION_FLAGS] ?? null;
$this->conn = mysqli_init();
......@@ -239,7 +239,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$exceptionMsg = "%s option '%s' with value '%s'";
foreach ($driverOptions as $option => $value) {
if ($option === static::OPTION_FLAGS) {
if ($option === self::OPTION_FLAGS) {
continue;
}
......
......@@ -225,9 +225,9 @@ class MysqliStatement implements IteratorAggregate, Statement
$streams[$parameter] = $value;
$values[$parameter] = null;
continue;
} else {
$types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
}
$types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
}
$values[$parameter] = $value;
......@@ -338,13 +338,10 @@ class MysqliStatement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::ASSOCIATIVE:
return $assoc;
case FetchMode::MIXED:
return $assoc + $values;
case FetchMode::STANDARD_OBJECT:
return (object) $assoc;
default:
throw new MysqliException(sprintf("Unknown fetch type '%s'", $fetchMode));
}
......
......@@ -254,6 +254,7 @@ class OCI8Statement implements IteratorAggregate, Statement
{
if (preg_match($regex, $statement, $matches, PREG_OFFSET_CAPTURE, $offset)) {
$offset = $matches[0][1];
return $matches[0][0];
}
......@@ -305,10 +306,8 @@ class OCI8Statement implements IteratorAggregate, Statement
switch ($type) {
case ParameterType::BINARY:
return OCI_B_BIN;
case ParameterType::LARGE_OBJECT:
return OCI_B_BLOB;
default:
return SQLT_CHR;
}
......
......@@ -210,13 +210,10 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::COLUMN:
return $this->fetchColumn();
case FetchMode::ASSOCIATIVE:
return sasql_fetch_assoc($this->result);
case FetchMode::MIXED:
return sasql_fetch_array($this->result, SASQL_BOTH);
case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs;
......@@ -234,13 +231,10 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
}
return $result;
case FetchMode::NUMERIC:
return sasql_fetch_row($this->result);
case FetchMode::STANDARD_OBJECT:
return sasql_fetch_object($this->result);
default:
throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode);
}
......
......@@ -100,7 +100,9 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
{
if (is_int($value)) {
return $value;
} elseif (is_float($value)) {
}
if (is_float($value)) {
return sprintf('%F', $value);
}
......
......@@ -174,7 +174,9 @@ final class DriverManager
// check for existing pdo object
if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) {
throw DBALException::invalidPdoInstance();
} elseif (isset($params['pdo'])) {
}
if (isset($params['pdo'])) {
$params['pdo']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$params['driver'] = 'pdo_' . $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME);
} else {
......
......@@ -2968,7 +2968,6 @@ abstract class AbstractPlatform
return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
}
/**
* Obtains DBMS specific SQL to be used to create date fields in statements
* like CREATE TABLE.
......
......@@ -501,6 +501,7 @@ class DB2Platform extends AbstractPlatform
foreach ($indexes as $definition) {
$sqls[] = $this->getCreateIndexSQL($definition, $tableName);
}
return $sqls;
}
......
......@@ -247,15 +247,15 @@ class MySqlPlatform extends AbstractPlatform
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
if ($length <= self::LENGTH_LIMIT_TINYTEXT) {
return 'TINYTEXT';
}
if ($length <= static::LENGTH_LIMIT_TEXT) {
if ($length <= self::LENGTH_LIMIT_TEXT) {
return 'TEXT';
}
if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) {
if ($length <= self::LENGTH_LIMIT_MEDIUMTEXT) {
return 'MEDIUMTEXT';
}
}
......@@ -1137,15 +1137,15 @@ SQL
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
if ($length <= self::LENGTH_LIMIT_TINYBLOB) {
return 'TINYBLOB';
}
if ($length <= static::LENGTH_LIMIT_BLOB) {
if ($length <= self::LENGTH_LIMIT_BLOB) {
return 'BLOB';
}
if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) {
if ($length <= self::LENGTH_LIMIT_MEDIUMBLOB) {
return 'MEDIUMBLOB';
}
}
......
......@@ -114,7 +114,6 @@ class OraclePlatform extends AbstractPlatform
}
return 'ADD_MONTHS(' . $date . ', ' . $operator . $interval . ')';
default:
$calculationClause = '';
......@@ -201,9 +200,13 @@ class OraclePlatform extends AbstractPlatform
{
if ($sequence->getCache() === 0) {
return ' NOCACHE';
} elseif ($sequence->getCache() === 1) {
}
if ($sequence->getCache() === 1) {
return ' NOCACHE';
} elseif ($sequence->getCache() > 1) {
}
if ($sequence->getCache() > 1) {
return ' CACHE ' . $sequence->getCache();
}
......@@ -739,11 +742,9 @@ SQL
// NO ACTION cannot be declared explicitly,
// therefore returning empty string to indicate to OMIT the referential clause.
return '';
case 'CASCADE':
case 'SET NULL':
return $action;
default:
// SET DEFAULT is not supported, throw exception instead.
throw new InvalidArgumentException('Invalid foreign key action: ' . $action);
......
......@@ -821,7 +821,7 @@ SQL
}
if (is_bool($value) || is_numeric($value)) {
return $callback($value ? true : false);
return $callback((bool) $value);
}
if (! is_string($value)) {
......
......@@ -49,13 +49,10 @@ class SQLAnywherePlatform extends AbstractPlatform
switch (true) {
case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (UPDLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (XLOCK)';
default:
return $fromClause;
}
......@@ -627,12 +624,15 @@ class SQLAnywherePlatform extends AbstractPlatform
switch ((int) $type) {
case self::FOREIGN_KEY_MATCH_SIMPLE:
return 'SIMPLE';
break;
case self::FOREIGN_KEY_MATCH_FULL:
return 'FULL';
break;
case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE:
return 'UNIQUE SIMPLE';
break;
case self::FOREIGN_KEY_MATCH_FULL_UNIQUE:
return 'UNIQUE FULL';
......
......@@ -1349,6 +1349,7 @@ SQL
$query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1);
$offset = $orderByPos;
}
return $query;
}
......@@ -1547,13 +1548,10 @@ SQL
switch (true) {
case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (UPDLOCK, ROWLOCK)';
default:
return $fromClause;
}
......
......@@ -128,7 +128,6 @@ class SqlitePlatform extends AbstractPlatform
case DateIntervalUnit::MINUTE:
case DateIntervalUnit::HOUR:
return 'DATETIME(' . $date . ",'" . $operator . $interval . ' ' . $unit . "')";
default:
switch ($unit) {
case DateIntervalUnit::WEEK:
......@@ -1070,12 +1069,14 @@ class SqlitePlatform extends AbstractPlatform
if (! isset($columnNames[$normalizedColumnName])) {
unset($indexes[$key]);
continue 2;
} else {
$indexColumns[] = $columnNames[$normalizedColumnName];
if ($columnName !== $columnNames[$normalizedColumnName]) {
$changed = true;
}
}
$indexColumns[] = $columnNames[$normalizedColumnName];
if ($columnName === $columnNames[$normalizedColumnName]) {
continue;
}
$changed = true;
}
if (! $changed) {
......@@ -1122,12 +1123,14 @@ class SqlitePlatform extends AbstractPlatform
if (! isset($columnNames[$normalizedColumnName])) {
unset($foreignKeys[$key]);
continue 2;
} else {
$localColumns[] = $columnNames[$normalizedColumnName];
if ($columnName !== $columnNames[$normalizedColumnName]) {
$changed = true;
}
}
$localColumns[] = $columnNames[$normalizedColumnName];
if ($columnName === $columnNames[$normalizedColumnName]) {
continue;
}
$changed = true;
}
if (! $changed) {
......
......@@ -866,7 +866,6 @@ class QueryBuilder
return $this->add('groupBy', $groupBy, false);
}
/**
* Adds a grouping expression to the query.
*
......@@ -1188,6 +1187,7 @@ class QueryBuilder
private function getSQLForUpdate()
{
$table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');
return 'UPDATE ' . $table
. ' SET ' . implode(', ', $this->sqlParts['set'])
. ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
......@@ -1201,6 +1201,7 @@ class QueryBuilder
private function getSQLForDelete()
{
$table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');
return 'DELETE FROM ' . $table . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
}
......
......@@ -854,7 +854,7 @@ abstract class AbstractSchemaManager
$result[$keyName] = [
'name' => $indexName,
'columns' => [],
'unique' => $tableIndex['non_unique'] ? false : true,
'unique' => ! $tableIndex['non_unique'],
'primary' => $tableIndex['primary'],
'flags' => $tableIndex['flags'] ?? [],
'options' => $options,
......
......@@ -178,7 +178,9 @@ class DB2SchemaManager extends AbstractSchemaManager
{
if ($def === 'C') {
return 'CASCADE';
} elseif ($def === 'N') {
}
if ($def === 'N') {
return 'SET NULL';
}
......
......@@ -243,7 +243,9 @@ class Index extends AbstractAsset implements Constraint
{
if ($other->isPrimary()) {
return false;
} elseif ($this->isSimpleIndex() && $other->isUnique()) {
}
if ($this->isSimpleIndex() && $other->isUnique()) {
return false;
}
......
......@@ -230,6 +230,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
case 'curtime()':
return $platform->getCurrentTimeSQL();
}
return $columnDefault;
}
......
......@@ -205,7 +205,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
$idx = [];
$idx['key_name'] = $keyName;
$idx['primary'] = false;
$idx['non_unique'] = $tableIndex['unique']?false:true;
$idx['non_unique'] = ! $tableIndex['unique'];
$stmt = $this->_conn->executeQuery(sprintf(
'PRAGMA INDEX_INFO (%s)',
......
......@@ -31,7 +31,6 @@ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer
return $createSchema->toSql($this->platform);
}
/**
* {@inheritdoc}
*/
......
......@@ -610,6 +610,7 @@ class Table extends AbstractAsset
foreach ($this->getForeignKeys() as $foreignKey) {
$foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getColumns());
}
return $this->filterColumns($foreignKeyColumns);
}
......
......@@ -65,6 +65,7 @@ class RemoveNamespacedAssets extends AbstractVisitor
// point to nowhere.
if (! $this->schema->hasTable($fkConstraint->getForeignTableName())) {
$localTable->removeForeignKey($fkConstraint->getName());
return;
}
......
......@@ -217,7 +217,9 @@ class Statement implements IteratorAggregate, DriverStatement
{
if ($arg2 === null) {
return $this->stmt->setFetchMode($fetchMode);
} elseif ($arg3 === null) {
}
if ($arg3 === null) {
return $this->stmt->setFetchMode($fetchMode, $arg2);
}
......
......@@ -73,7 +73,9 @@ EOT
throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not exist.", $filePath)
);
} elseif (! is_readable($filePath)) {
}
if (! is_readable($filePath)) {
throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath)
);
......
......@@ -73,6 +73,7 @@ final class Dumper
try {
$output = ob_get_clean();
assert(is_string($output));
return strip_tags(html_entity_decode($output));
} finally {
ini_set('html_errors', $html);
......
......@@ -60,7 +60,7 @@
</rule>
<!-- see https://github.com/doctrine/dbal/issues/3377 -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEqualOperators.DisallowedNotEqualOperator">
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator">
<exclude-pattern>lib/Doctrine/DBAL/Schema/Comparator.php</exclude-pattern>
</rule>
</ruleset>
......@@ -36,7 +36,7 @@ use function strtotime;
class DataAccessTest extends DbalFunctionalTestCase
{
/** @var bool */
static private $generated = false;
private static $generated = false;
protected function setUp() : void
{
......
......@@ -223,6 +223,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
}
$stmt->closeCursor();
return $data;
}
......@@ -234,6 +235,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
}
$stmt->closeCursor();
return $data;
}
}
......@@ -390,6 +390,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
if (! $this->schemaManager->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$this->markTestSkipped('Requires PostgresSQL 9.4+');
return;
}
......
......@@ -56,6 +56,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$class = static::class;
$e = explode('\\', $class);
$testClass = end($e);
return strtolower(str_replace('SchemaManagerTest', null, $testClass));
}
......@@ -72,7 +73,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this->schemaManager = $this->connection->getSchemaManager();
}
protected function tearDown() : void
{
parent::tearDown();
......@@ -88,7 +88,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
}
}
/**
* @group DBAL-1220
*/
......@@ -632,7 +631,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
self::assertEquals(['id'], array_map('strtolower', $foreignKey->getForeignColumns()));
}
public function testTableInNamespace()
{
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
......@@ -982,6 +980,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$table->setPrimaryKey(['id']);
$table->addColumn('test', 'string', ['length' => 255]);
$table->addColumn('foreign_key_test', 'integer');
return $table;
}
......@@ -993,6 +992,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$table->addColumn('other_id', 'integer', ['notnull' => true]);
$table->setPrimaryKey(['id', 'other_id']);
$table->addColumn('test', 'string', ['length' => 255]);
return $table;
}
......
......@@ -13,7 +13,7 @@ use function str_repeat;
class TypeConversionTest extends DbalFunctionalTestCase
{
/** @var int */
static private $typeCounter = 0;
private static $typeCounter = 0;
protected function setUp() : void
{
......
......@@ -8,8 +8,6 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DbalPerformanceTestCase;
/**
* Class TypeConversionPerformanceTest
*
* @group performance
*/
class TypeConversionPerformanceTest extends DbalPerformanceTestCase
......
......@@ -75,7 +75,6 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
);
}
public function testGeneratesDDLSnippets()
{
self::assertEquals('SHOW DATABASES', $this->platform->getListDatabasesSQL());
......
......@@ -628,8 +628,11 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
}
abstract protected function getQuotedColumnInPrimaryKeySQL();
abstract protected function getQuotedColumnInIndexSQL();
abstract protected function getQuotedNameInIndexSQL();
abstract protected function getQuotedColumnInForeignKeySQL();
/**
......
......@@ -44,7 +44,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
);
}
public function testModifyLimitQuery()
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
......@@ -270,7 +269,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
self::assertEquals($sql, $expected);
}
/**
* @throws DBALException
*/
......
......@@ -99,6 +99,7 @@ class ColumnTest extends TestCase
];
$string = Type::getType('string');
return new Column('foo', $string, $options);
}
......
......@@ -795,7 +795,6 @@ class ComparatorTest extends TestCase
self::assertArrayHasKey('id', $tableDiff->changedColumns);
}
/**
* @group DBAL-105
*/
......@@ -823,7 +822,6 @@ class ComparatorTest extends TestCase
self::assertCount(0, $tableDiff->removedColumns);
}
/**
* @group DBAL-112
*/
......@@ -963,7 +961,6 @@ class ComparatorTest extends TestCase
self::assertCount(0, $diff->removedSequences);
}
/**
* Check that added autoincrement sequence is not populated in newSequences
*
......@@ -987,6 +984,7 @@ class ComparatorTest extends TestCase
self::assertCount(0, $diff->newSequences);
}
/**
* You can get multiple drops for a FK when a table referenced by a foreign
* key is deleted, as this FK is referenced twice, once on the orphanedForeignKeys
......
......@@ -118,6 +118,7 @@ class SchemaDiffTest extends TestCase
$fk = new ForeignKeyConstraint(['id'], 'foreign_table', ['id']);
$fk->setLocalTable(new Table('local_table'));
$diff->orphanedForeignKeys[] = $fk;
return $diff;
}
}
......@@ -25,6 +25,7 @@ class PoolingShardManagerTest extends TestCase
->will($this->returnCallback(static function ($value) {
return $value;
}));
return $mock;
}
......@@ -34,6 +35,7 @@ class PoolingShardManagerTest extends TestCase
$mock->expects($this->any())
->method('pickShard')
->willReturn(1);
return $mock;
}
......
......@@ -89,6 +89,7 @@ class SQLAzureShardManagerTest extends TestCase
->disableOriginalConstructor()
->getMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params));
return $conn;
}
}
......@@ -26,6 +26,7 @@ class ConversionExceptionTest extends TestCase
$exception->getMessage()
);
}
/**
* @param mixed $nonScalar
*
......
......@@ -74,7 +74,9 @@ abstract class DbalFunctionalTestCase extends DbalTestCase
$params = array_map(static function ($p) {
if (is_object($p)) {
return get_class($p);
} elseif (is_scalar($p)) {
}
if (is_scalar($p)) {
return "'" . $p . "'";
}
......
......@@ -10,6 +10,7 @@ class DriverConnectionMock implements Connection
public function prepare($prepareString)
{
}
public function query()
{
}
......@@ -21,21 +22,27 @@ class DriverConnectionMock implements Connection
public function exec($statement)
{
}
public function lastInsertId($name = null)
{
}
public function beginTransaction()
{
}
public function commit()
{
}
public function rollBack()
{
}
public function errorCode()
{
}
public function errorInfo()
{
}
......
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