Unverified Commit 546cd674 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #3489 from amaabdou/feature/upgrade_doctrine_cs_6_0

Update doctrine coding standard from 5.0 to 6.0
parents 5b5c2c93 bf068443
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "dc19a584f29861609d085123b65f3961", "content-hash": "ddba260b7dfb84d2591b0a71a885166a",
"packages": [ "packages": [
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
...@@ -202,29 +202,27 @@ ...@@ -202,29 +202,27 @@
}, },
{ {
"name": "dealerdirect/phpcodesniffer-composer-installer", "name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.4.4", "version": "v0.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08" "reference": "e749410375ff6fb7a040a68878c656c2e610b132"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08", "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132",
"reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08", "reference": "e749410375ff6fb7a040a68878c656c2e610b132",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer-plugin-api": "^1.0", "composer-plugin-api": "^1.0",
"php": "^5.3|^7", "php": "^5.3|^7",
"squizlabs/php_codesniffer": "*" "squizlabs/php_codesniffer": "^2|^3"
}, },
"require-dev": { "require-dev": {
"composer/composer": "*", "composer/composer": "*",
"wimg/php-compatibility": "^8.0" "phpcompatibility/php-compatibility": "^9.0",
}, "sensiolabs/security-checker": "^4.1.0"
"suggest": {
"dealerdirect/qa-tools": "All the PHP QA tools you'll need"
}, },
"type": "composer-plugin", "type": "composer-plugin",
"extra": { "extra": {
...@@ -242,13 +240,13 @@ ...@@ -242,13 +240,13 @@
"authors": [ "authors": [
{ {
"name": "Franck Nijhof", "name": "Franck Nijhof",
"email": "f.nijhof@dealerdirect.nl", "email": "franck.nijhof@dealerdirect.com",
"homepage": "http://workingatdealerdirect.eu", "homepage": "http://www.frenck.nl",
"role": "Developer" "role": "Developer / IT Manager"
} }
], ],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin", "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://workingatdealerdirect.eu", "homepage": "http://www.dealerdirect.com",
"keywords": [ "keywords": [
"PHPCodeSniffer", "PHPCodeSniffer",
"PHP_CodeSniffer", "PHP_CodeSniffer",
...@@ -266,32 +264,32 @@ ...@@ -266,32 +264,32 @@
"stylecheck", "stylecheck",
"tests" "tests"
], ],
"time": "2017-12-06T16:27:17+00:00" "time": "2018-10-26T13:21:45+00:00"
}, },
{ {
"name": "doctrine/coding-standard", "name": "doctrine/coding-standard",
"version": "5.0.0", "version": "6.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/coding-standard.git", "url": "https://github.com/doctrine/coding-standard.git",
"reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c" "reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/bb8de042a25c4fb59a2c55c350dc55cc00227a8c", "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/d33f69eb98b25aa51ffe3a909f0ec77000af4701",
"reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c", "reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"php": "^7.1", "php": "^7.1",
"slevomat/coding-standard": "^4.8.0", "slevomat/coding-standard": "^5.0",
"squizlabs/php_codesniffer": "^3.3.2" "squizlabs/php_codesniffer": "^3.4.0"
}, },
"type": "phpcodesniffer-standard", "type": "phpcodesniffer-standard",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0.x-dev" "dev-master": "6.0.x-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -327,7 +325,7 @@ ...@@ -327,7 +325,7 @@
"standard", "standard",
"style" "style"
], ],
"time": "2018-09-24T19:08:56+00:00" "time": "2019-03-15T12:45:47+00:00"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
...@@ -2486,29 +2484,30 @@ ...@@ -2486,29 +2484,30 @@
}, },
{ {
"name": "slevomat/coding-standard", "name": "slevomat/coding-standard",
"version": "4.8.3", "version": "5.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/slevomat/coding-standard.git", "url": "https://github.com/slevomat/coding-standard.git",
"reference": "32e1ca205fc34920f323582ed29c0602e3897ae3" "reference": "223f02b6193fe47b7b483bfa5bf75693535482dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/32e1ca205fc34920f323582ed29c0602e3897ae3", "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/223f02b6193fe47b7b483bfa5bf75693535482dd",
"reference": "32e1ca205fc34920f323582ed29c0602e3897ae3", "reference": "223f02b6193fe47b7b483bfa5bf75693535482dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1", "php": "^7.1",
"squizlabs/php_codesniffer": "^3.3.0" "phpstan/phpdoc-parser": "^0.3.1",
"squizlabs/php_codesniffer": "^3.4.0"
}, },
"require-dev": { "require-dev": {
"jakub-onderka/php-parallel-lint": "1.0.0", "jakub-onderka/php-parallel-lint": "1.0.0",
"phing/phing": "2.16.1", "phing/phing": "2.16.1",
"phpstan/phpstan": "0.9.2", "phpstan/phpstan": "0.11.1",
"phpstan/phpstan-phpunit": "0.9.4", "phpstan/phpstan-phpunit": "0.11",
"phpstan/phpstan-strict-rules": "0.9", "phpstan/phpstan-strict-rules": "0.11",
"phpunit/phpunit": "7.3.5" "phpunit/phpunit": "8.0.0"
}, },
"type": "phpcodesniffer-standard", "type": "phpcodesniffer-standard",
"autoload": { "autoload": {
...@@ -2521,20 +2520,20 @@ ...@@ -2521,20 +2520,20 @@
"MIT" "MIT"
], ],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "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", "name": "squizlabs/php_codesniffer",
"version": "3.3.2", "version": "3.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e" "reference": "379deb987e26c7cd103a7b387aea178baec96e48"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e", "reference": "379deb987e26c7cd103a7b387aea178baec96e48",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -2572,7 +2571,7 @@ ...@@ -2572,7 +2571,7 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2018-09-23T23:08:17+00:00" "time": "2018-12-19T23:57:18+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
......
...@@ -107,6 +107,7 @@ class Configuration ...@@ -107,6 +107,7 @@ class Configuration
if ($assetName instanceof AbstractAsset) { if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName(); $assetName = $assetName->getName();
} }
return preg_match($filterExpression, $assetName); return preg_match($filterExpression, $assetName);
}; };
} }
...@@ -116,7 +117,8 @@ class Configuration ...@@ -116,7 +117,8 @@ class Configuration
*/ */
public function setSchemaAssetsFilter(?callable $callable = null) : ?callable public function setSchemaAssetsFilter(?callable $callable = null) : ?callable
{ {
$this->_attributes['filterSchemaAssetsExpression'] = null; $this->_attributes['filterSchemaAssetsExpression'] = null;
return $this->_attributes['filterSchemaAssetsExpressionCallable'] = $callable; return $this->_attributes['filterSchemaAssetsExpressionCallable'] = $callable;
} }
......
...@@ -1161,6 +1161,7 @@ class Connection implements DriverConnection ...@@ -1161,6 +1161,7 @@ class Connection implements DriverConnection
try { try {
$res = $func($this); $res = $func($this);
$this->commit(); $this->commit();
return $res; return $res;
} catch (Exception $e) { } catch (Exception $e) {
$this->rollBack(); $this->rollBack();
......
...@@ -225,9 +225,9 @@ class MysqliStatement implements IteratorAggregate, Statement ...@@ -225,9 +225,9 @@ class MysqliStatement implements IteratorAggregate, Statement
$streams[$parameter] = $value; $streams[$parameter] = $value;
$values[$parameter] = null; $values[$parameter] = null;
continue; continue;
} else {
$types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
} }
$types[$parameter - 1] = static::$_paramTypeMap[ParameterType::STRING];
} }
$values[$parameter] = $value; $values[$parameter] = $value;
......
...@@ -254,6 +254,7 @@ class OCI8Statement implements IteratorAggregate, Statement ...@@ -254,6 +254,7 @@ class OCI8Statement implements IteratorAggregate, Statement
{ {
if (preg_match($regex, $statement, $matches, PREG_OFFSET_CAPTURE, $offset)) { if (preg_match($regex, $statement, $matches, PREG_OFFSET_CAPTURE, $offset)) {
$offset = $matches[0][1]; $offset = $matches[0][1];
return $matches[0][0]; return $matches[0][0];
} }
......
...@@ -100,7 +100,9 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection ...@@ -100,7 +100,9 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
{ {
if (is_int($value)) { if (is_int($value)) {
return $value; return $value;
} elseif (is_float($value)) { }
if (is_float($value)) {
return sprintf('%F', $value); return sprintf('%F', $value);
} }
......
...@@ -174,7 +174,9 @@ final class DriverManager ...@@ -174,7 +174,9 @@ final class DriverManager
// check for existing pdo object // check for existing pdo object
if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) { if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) {
throw DBALException::invalidPdoInstance(); throw DBALException::invalidPdoInstance();
} elseif (isset($params['pdo'])) { }
if (isset($params['pdo'])) {
$params['pdo']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $params['pdo']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$params['driver'] = 'pdo_' . $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME); $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME);
} else { } else {
......
...@@ -2968,7 +2968,6 @@ abstract class AbstractPlatform ...@@ -2968,7 +2968,6 @@ abstract class AbstractPlatform
return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration); return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
} }
/** /**
* Obtains DBMS specific SQL to be used to create date fields in statements * Obtains DBMS specific SQL to be used to create date fields in statements
* like CREATE TABLE. * like CREATE TABLE.
......
...@@ -501,6 +501,7 @@ class DB2Platform extends AbstractPlatform ...@@ -501,6 +501,7 @@ class DB2Platform extends AbstractPlatform
foreach ($indexes as $definition) { foreach ($indexes as $definition) {
$sqls[] = $this->getCreateIndexSQL($definition, $tableName); $sqls[] = $this->getCreateIndexSQL($definition, $tableName);
} }
return $sqls; return $sqls;
} }
......
...@@ -201,9 +201,13 @@ class OraclePlatform extends AbstractPlatform ...@@ -201,9 +201,13 @@ class OraclePlatform extends AbstractPlatform
{ {
if ($sequence->getCache() === 0) { if ($sequence->getCache() === 0) {
return ' NOCACHE'; return ' NOCACHE';
} elseif ($sequence->getCache() === 1) { }
if ($sequence->getCache() === 1) {
return ' NOCACHE'; return ' NOCACHE';
} elseif ($sequence->getCache() > 1) { }
if ($sequence->getCache() > 1) {
return ' CACHE ' . $sequence->getCache(); return ' CACHE ' . $sequence->getCache();
} }
......
...@@ -821,7 +821,7 @@ SQL ...@@ -821,7 +821,7 @@ SQL
} }
if (is_bool($value) || is_numeric($value)) { if (is_bool($value) || is_numeric($value)) {
return $callback($value ? true : false); return $callback((bool) $value);
} }
if (! is_string($value)) { if (! is_string($value)) {
......
...@@ -627,12 +627,15 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -627,12 +627,15 @@ class SQLAnywherePlatform extends AbstractPlatform
switch ((int) $type) { switch ((int) $type) {
case self::FOREIGN_KEY_MATCH_SIMPLE: case self::FOREIGN_KEY_MATCH_SIMPLE:
return 'SIMPLE'; return 'SIMPLE';
break; break;
case self::FOREIGN_KEY_MATCH_FULL: case self::FOREIGN_KEY_MATCH_FULL:
return 'FULL'; return 'FULL';
break; break;
case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE: case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE:
return 'UNIQUE SIMPLE'; return 'UNIQUE SIMPLE';
break; break;
case self::FOREIGN_KEY_MATCH_FULL_UNIQUE: case self::FOREIGN_KEY_MATCH_FULL_UNIQUE:
return 'UNIQUE FULL'; return 'UNIQUE FULL';
......
...@@ -1349,6 +1349,7 @@ SQL ...@@ -1349,6 +1349,7 @@ SQL
$query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1); $query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1);
$offset = $orderByPos; $offset = $orderByPos;
} }
return $query; return $query;
} }
......
...@@ -1070,12 +1070,14 @@ class SqlitePlatform extends AbstractPlatform ...@@ -1070,12 +1070,14 @@ class SqlitePlatform extends AbstractPlatform
if (! isset($columnNames[$normalizedColumnName])) { if (! isset($columnNames[$normalizedColumnName])) {
unset($indexes[$key]); unset($indexes[$key]);
continue 2; continue 2;
} else {
$indexColumns[] = $columnNames[$normalizedColumnName];
if ($columnName !== $columnNames[$normalizedColumnName]) {
$changed = true;
}
} }
$indexColumns[] = $columnNames[$normalizedColumnName];
if ($columnName === $columnNames[$normalizedColumnName]) {
continue;
}
$changed = true;
} }
if (! $changed) { if (! $changed) {
...@@ -1122,12 +1124,14 @@ class SqlitePlatform extends AbstractPlatform ...@@ -1122,12 +1124,14 @@ class SqlitePlatform extends AbstractPlatform
if (! isset($columnNames[$normalizedColumnName])) { if (! isset($columnNames[$normalizedColumnName])) {
unset($foreignKeys[$key]); unset($foreignKeys[$key]);
continue 2; continue 2;
} else {
$localColumns[] = $columnNames[$normalizedColumnName];
if ($columnName !== $columnNames[$normalizedColumnName]) {
$changed = true;
}
} }
$localColumns[] = $columnNames[$normalizedColumnName];
if ($columnName === $columnNames[$normalizedColumnName]) {
continue;
}
$changed = true;
} }
if (! $changed) { if (! $changed) {
......
...@@ -866,7 +866,6 @@ class QueryBuilder ...@@ -866,7 +866,6 @@ class QueryBuilder
return $this->add('groupBy', $groupBy, false); return $this->add('groupBy', $groupBy, false);
} }
/** /**
* Adds a grouping expression to the query. * Adds a grouping expression to the query.
* *
...@@ -1188,6 +1187,7 @@ class QueryBuilder ...@@ -1188,6 +1187,7 @@ class QueryBuilder
private function getSQLForUpdate() private function getSQLForUpdate()
{ {
$table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');
return 'UPDATE ' . $table return 'UPDATE ' . $table
. ' SET ' . implode(', ', $this->sqlParts['set']) . ' SET ' . implode(', ', $this->sqlParts['set'])
. ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : ''); . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
...@@ -1201,6 +1201,7 @@ class QueryBuilder ...@@ -1201,6 +1201,7 @@ class QueryBuilder
private function getSQLForDelete() private function getSQLForDelete()
{ {
$table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : ''); $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']) : ''); return 'DELETE FROM ' . $table . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
} }
......
...@@ -854,7 +854,7 @@ abstract class AbstractSchemaManager ...@@ -854,7 +854,7 @@ abstract class AbstractSchemaManager
$result[$keyName] = [ $result[$keyName] = [
'name' => $indexName, 'name' => $indexName,
'columns' => [], 'columns' => [],
'unique' => $tableIndex['non_unique'] ? false : true, 'unique' => ! $tableIndex['non_unique'],
'primary' => $tableIndex['primary'], 'primary' => $tableIndex['primary'],
'flags' => $tableIndex['flags'] ?? [], 'flags' => $tableIndex['flags'] ?? [],
'options' => $options, 'options' => $options,
......
...@@ -178,7 +178,9 @@ class DB2SchemaManager extends AbstractSchemaManager ...@@ -178,7 +178,9 @@ class DB2SchemaManager extends AbstractSchemaManager
{ {
if ($def === 'C') { if ($def === 'C') {
return 'CASCADE'; return 'CASCADE';
} elseif ($def === 'N') { }
if ($def === 'N') {
return 'SET NULL'; return 'SET NULL';
} }
......
...@@ -243,7 +243,9 @@ class Index extends AbstractAsset implements Constraint ...@@ -243,7 +243,9 @@ class Index extends AbstractAsset implements Constraint
{ {
if ($other->isPrimary()) { if ($other->isPrimary()) {
return false; return false;
} elseif ($this->isSimpleIndex() && $other->isUnique()) { }
if ($this->isSimpleIndex() && $other->isUnique()) {
return false; return false;
} }
......
...@@ -230,6 +230,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -230,6 +230,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
case 'curtime()': case 'curtime()':
return $platform->getCurrentTimeSQL(); return $platform->getCurrentTimeSQL();
} }
return $columnDefault; return $columnDefault;
} }
......
...@@ -205,7 +205,7 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -205,7 +205,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
$idx = []; $idx = [];
$idx['key_name'] = $keyName; $idx['key_name'] = $keyName;
$idx['primary'] = false; $idx['primary'] = false;
$idx['non_unique'] = $tableIndex['unique']?false:true; $idx['non_unique'] = ! $tableIndex['unique'];
$stmt = $this->_conn->executeQuery(sprintf( $stmt = $this->_conn->executeQuery(sprintf(
'PRAGMA INDEX_INFO (%s)', 'PRAGMA INDEX_INFO (%s)',
......
...@@ -31,7 +31,6 @@ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer ...@@ -31,7 +31,6 @@ class SingleDatabaseSynchronizer extends AbstractSchemaSynchronizer
return $createSchema->toSql($this->platform); return $createSchema->toSql($this->platform);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -610,6 +610,7 @@ class Table extends AbstractAsset ...@@ -610,6 +610,7 @@ class Table extends AbstractAsset
foreach ($this->getForeignKeys() as $foreignKey) { foreach ($this->getForeignKeys() as $foreignKey) {
$foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getColumns()); $foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getColumns());
} }
return $this->filterColumns($foreignKeyColumns); return $this->filterColumns($foreignKeyColumns);
} }
......
...@@ -65,6 +65,7 @@ class RemoveNamespacedAssets extends AbstractVisitor ...@@ -65,6 +65,7 @@ class RemoveNamespacedAssets extends AbstractVisitor
// point to nowhere. // point to nowhere.
if (! $this->schema->hasTable($fkConstraint->getForeignTableName())) { if (! $this->schema->hasTable($fkConstraint->getForeignTableName())) {
$localTable->removeForeignKey($fkConstraint->getName()); $localTable->removeForeignKey($fkConstraint->getName());
return; return;
} }
......
...@@ -217,7 +217,9 @@ class Statement implements IteratorAggregate, DriverStatement ...@@ -217,7 +217,9 @@ class Statement implements IteratorAggregate, DriverStatement
{ {
if ($arg2 === null) { if ($arg2 === null) {
return $this->stmt->setFetchMode($fetchMode); return $this->stmt->setFetchMode($fetchMode);
} elseif ($arg3 === null) { }
if ($arg3 === null) {
return $this->stmt->setFetchMode($fetchMode, $arg2); return $this->stmt->setFetchMode($fetchMode, $arg2);
} }
......
...@@ -73,7 +73,9 @@ EOT ...@@ -73,7 +73,9 @@ EOT
throw new InvalidArgumentException( throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not exist.", $filePath) sprintf("SQL file '<info>%s</info>' does not exist.", $filePath)
); );
} elseif (! is_readable($filePath)) { }
if (! is_readable($filePath)) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath) sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath)
); );
......
...@@ -73,6 +73,7 @@ final class Dumper ...@@ -73,6 +73,7 @@ final class Dumper
try { try {
$output = ob_get_clean(); $output = ob_get_clean();
assert(is_string($output)); assert(is_string($output));
return strip_tags(html_entity_decode($output)); return strip_tags(html_entity_decode($output));
} finally { } finally {
ini_set('html_errors', $html); ini_set('html_errors', $html);
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/> <exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/> <exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/> <exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
</rule> </rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
</rule> </rule>
<!-- see https://github.com/doctrine/dbal/issues/3377 --> <!-- 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> <exclude-pattern>lib/Doctrine/DBAL/Schema/Comparator.php</exclude-pattern>
</rule> </rule>
</ruleset> </ruleset>
...@@ -36,7 +36,7 @@ use function strtotime; ...@@ -36,7 +36,7 @@ use function strtotime;
class DataAccessTest extends DbalFunctionalTestCase class DataAccessTest extends DbalFunctionalTestCase
{ {
/** @var bool */ /** @var bool */
static private $generated = false; private static $generated = false;
protected function setUp() : void protected function setUp() : void
{ {
......
...@@ -223,6 +223,7 @@ class ResultCacheTest extends DbalFunctionalTestCase ...@@ -223,6 +223,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row; $data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
} }
$stmt->closeCursor(); $stmt->closeCursor();
return $data; return $data;
} }
...@@ -234,6 +235,7 @@ class ResultCacheTest extends DbalFunctionalTestCase ...@@ -234,6 +235,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
$data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row; $data[] = is_array($row) ? array_change_key_case($row, CASE_LOWER) : $row;
} }
$stmt->closeCursor(); $stmt->closeCursor();
return $data; return $data;
} }
} }
...@@ -390,6 +390,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -390,6 +390,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
{ {
if (! $this->schemaManager->getDatabasePlatform() instanceof PostgreSQL94Platform) { if (! $this->schemaManager->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$this->markTestSkipped('Requires PostgresSQL 9.4+'); $this->markTestSkipped('Requires PostgresSQL 9.4+');
return; return;
} }
......
...@@ -56,6 +56,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -56,6 +56,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$class = static::class; $class = static::class;
$e = explode('\\', $class); $e = explode('\\', $class);
$testClass = end($e); $testClass = end($e);
return strtolower(str_replace('SchemaManagerTest', null, $testClass)); return strtolower(str_replace('SchemaManagerTest', null, $testClass));
} }
...@@ -72,7 +73,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -72,7 +73,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$this->schemaManager = $this->connection->getSchemaManager(); $this->schemaManager = $this->connection->getSchemaManager();
} }
protected function tearDown() : void protected function tearDown() : void
{ {
parent::tearDown(); parent::tearDown();
...@@ -88,7 +88,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -88,7 +88,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
} }
} }
/** /**
* @group DBAL-1220 * @group DBAL-1220
*/ */
...@@ -632,7 +631,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -632,7 +631,6 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
self::assertEquals(['id'], array_map('strtolower', $foreignKey->getForeignColumns())); self::assertEquals(['id'], array_map('strtolower', $foreignKey->getForeignColumns()));
} }
public function testTableInNamespace() public function testTableInNamespace()
{ {
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) { if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
...@@ -982,6 +980,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -982,6 +980,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$table->addColumn('test', 'string', ['length' => 255]); $table->addColumn('test', 'string', ['length' => 255]);
$table->addColumn('foreign_key_test', 'integer'); $table->addColumn('foreign_key_test', 'integer');
return $table; return $table;
} }
...@@ -993,6 +992,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase ...@@ -993,6 +992,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
$table->addColumn('other_id', 'integer', ['notnull' => true]); $table->addColumn('other_id', 'integer', ['notnull' => true]);
$table->setPrimaryKey(['id', 'other_id']); $table->setPrimaryKey(['id', 'other_id']);
$table->addColumn('test', 'string', ['length' => 255]); $table->addColumn('test', 'string', ['length' => 255]);
return $table; return $table;
} }
......
...@@ -13,7 +13,7 @@ use function str_repeat; ...@@ -13,7 +13,7 @@ use function str_repeat;
class TypeConversionTest extends DbalFunctionalTestCase class TypeConversionTest extends DbalFunctionalTestCase
{ {
/** @var int */ /** @var int */
static private $typeCounter = 0; private static $typeCounter = 0;
protected function setUp() : void protected function setUp() : void
{ {
......
...@@ -8,8 +8,6 @@ use Doctrine\DBAL\Types\Type; ...@@ -8,8 +8,6 @@ use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DbalPerformanceTestCase; use Doctrine\Tests\DbalPerformanceTestCase;
/** /**
* Class TypeConversionPerformanceTest
*
* @group performance * @group performance
*/ */
class TypeConversionPerformanceTest extends DbalPerformanceTestCase class TypeConversionPerformanceTest extends DbalPerformanceTestCase
......
...@@ -75,7 +75,6 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase ...@@ -75,7 +75,6 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
); );
} }
public function testGeneratesDDLSnippets() public function testGeneratesDDLSnippets()
{ {
self::assertEquals('SHOW DATABASES', $this->platform->getListDatabasesSQL()); self::assertEquals('SHOW DATABASES', $this->platform->getListDatabasesSQL());
......
...@@ -628,8 +628,11 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -628,8 +628,11 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
} }
abstract protected function getQuotedColumnInPrimaryKeySQL(); abstract protected function getQuotedColumnInPrimaryKeySQL();
abstract protected function getQuotedColumnInIndexSQL(); abstract protected function getQuotedColumnInIndexSQL();
abstract protected function getQuotedNameInIndexSQL(); abstract protected function getQuotedNameInIndexSQL();
abstract protected function getQuotedColumnInForeignKeySQL(); abstract protected function getQuotedColumnInForeignKeySQL();
/** /**
......
...@@ -44,7 +44,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase ...@@ -44,7 +44,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
); );
} }
public function testModifyLimitQuery() public function testModifyLimitQuery()
{ {
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
...@@ -270,7 +269,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase ...@@ -270,7 +269,6 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
self::assertEquals($sql, $expected); self::assertEquals($sql, $expected);
} }
/** /**
* @throws DBALException * @throws DBALException
*/ */
......
...@@ -99,6 +99,7 @@ class ColumnTest extends TestCase ...@@ -99,6 +99,7 @@ class ColumnTest extends TestCase
]; ];
$string = Type::getType('string'); $string = Type::getType('string');
return new Column('foo', $string, $options); return new Column('foo', $string, $options);
} }
......
...@@ -795,7 +795,6 @@ class ComparatorTest extends TestCase ...@@ -795,7 +795,6 @@ class ComparatorTest extends TestCase
self::assertArrayHasKey('id', $tableDiff->changedColumns); self::assertArrayHasKey('id', $tableDiff->changedColumns);
} }
/** /**
* @group DBAL-105 * @group DBAL-105
*/ */
...@@ -823,7 +822,6 @@ class ComparatorTest extends TestCase ...@@ -823,7 +822,6 @@ class ComparatorTest extends TestCase
self::assertCount(0, $tableDiff->removedColumns); self::assertCount(0, $tableDiff->removedColumns);
} }
/** /**
* @group DBAL-112 * @group DBAL-112
*/ */
...@@ -963,7 +961,6 @@ class ComparatorTest extends TestCase ...@@ -963,7 +961,6 @@ class ComparatorTest extends TestCase
self::assertCount(0, $diff->removedSequences); self::assertCount(0, $diff->removedSequences);
} }
/** /**
* Check that added autoincrement sequence is not populated in newSequences * Check that added autoincrement sequence is not populated in newSequences
* *
...@@ -987,6 +984,7 @@ class ComparatorTest extends TestCase ...@@ -987,6 +984,7 @@ class ComparatorTest extends TestCase
self::assertCount(0, $diff->newSequences); self::assertCount(0, $diff->newSequences);
} }
/** /**
* You can get multiple drops for a FK when a table referenced by a foreign * 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 * key is deleted, as this FK is referenced twice, once on the orphanedForeignKeys
......
...@@ -118,6 +118,7 @@ class SchemaDiffTest extends TestCase ...@@ -118,6 +118,7 @@ class SchemaDiffTest extends TestCase
$fk = new ForeignKeyConstraint(['id'], 'foreign_table', ['id']); $fk = new ForeignKeyConstraint(['id'], 'foreign_table', ['id']);
$fk->setLocalTable(new Table('local_table')); $fk->setLocalTable(new Table('local_table'));
$diff->orphanedForeignKeys[] = $fk; $diff->orphanedForeignKeys[] = $fk;
return $diff; return $diff;
} }
} }
...@@ -25,6 +25,7 @@ class PoolingShardManagerTest extends TestCase ...@@ -25,6 +25,7 @@ class PoolingShardManagerTest extends TestCase
->will($this->returnCallback(static function ($value) { ->will($this->returnCallback(static function ($value) {
return $value; return $value;
})); }));
return $mock; return $mock;
} }
...@@ -34,6 +35,7 @@ class PoolingShardManagerTest extends TestCase ...@@ -34,6 +35,7 @@ class PoolingShardManagerTest extends TestCase
$mock->expects($this->any()) $mock->expects($this->any())
->method('pickShard') ->method('pickShard')
->willReturn(1); ->willReturn(1);
return $mock; return $mock;
} }
......
...@@ -89,6 +89,7 @@ class SQLAzureShardManagerTest extends TestCase ...@@ -89,6 +89,7 @@ class SQLAzureShardManagerTest extends TestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params)); $conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params));
return $conn; return $conn;
} }
} }
...@@ -26,6 +26,7 @@ class ConversionExceptionTest extends TestCase ...@@ -26,6 +26,7 @@ class ConversionExceptionTest extends TestCase
$exception->getMessage() $exception->getMessage()
); );
} }
/** /**
* @param mixed $nonScalar * @param mixed $nonScalar
* *
......
...@@ -74,7 +74,9 @@ abstract class DbalFunctionalTestCase extends DbalTestCase ...@@ -74,7 +74,9 @@ abstract class DbalFunctionalTestCase extends DbalTestCase
$params = array_map(static function ($p) { $params = array_map(static function ($p) {
if (is_object($p)) { if (is_object($p)) {
return get_class($p); return get_class($p);
} elseif (is_scalar($p)) { }
if (is_scalar($p)) {
return "'" . $p . "'"; return "'" . $p . "'";
} }
......
...@@ -10,6 +10,7 @@ class DriverConnectionMock implements Connection ...@@ -10,6 +10,7 @@ class DriverConnectionMock implements Connection
public function prepare($prepareString) public function prepare($prepareString)
{ {
} }
public function query() public function query()
{ {
} }
...@@ -21,21 +22,27 @@ class DriverConnectionMock implements Connection ...@@ -21,21 +22,27 @@ class DriverConnectionMock implements Connection
public function exec($statement) public function exec($statement)
{ {
} }
public function lastInsertId($name = null) public function lastInsertId($name = null)
{ {
} }
public function beginTransaction() public function beginTransaction()
{ {
} }
public function commit() public function commit()
{ {
} }
public function rollBack() public function rollBack()
{ {
} }
public function errorCode() public function errorCode()
{ {
} }
public function errorInfo() 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