Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doctrine coding standard from 5.0 to 6.0 #3489

Merged
merged 2 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"doctrine/event-manager": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "^5.0",
"doctrine/coding-standard": "^6.0",
"jetbrains/phpstorm-stubs": "^2018.1.2",
"phpstan/phpstan": "^0.11.3",
"phpunit/phpunit": "^8.0",
Expand Down
77 changes: 38 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/Doctrine/DBAL/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private function buildSchemaAssetsFilterFromExpression($filterExpression) : call
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}

return preg_match($filterExpression, $assetName);
};
}
Expand All @@ -116,7 +117,8 @@ private function buildSchemaAssetsFilterFromExpression($filterExpression) : call
*/
public function setSchemaAssetsFilter(?callable $callable = null) : ?callable
{
$this->_attributes['filterSchemaAssetsExpression'] = null;
$this->_attributes['filterSchemaAssetsExpression'] = null;

return $this->_attributes['filterSchemaAssetsExpressionCallable'] = $callable;
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ public function transactional(Closure $func)
try {
$res = $func($this);
$this->commit();

return $res;
} catch (Exception $e) {
$this->rollBack();
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ private function bindTypedParameters()
$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;
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ private static function findToken($statement, &$offset, $regex)
{
if (preg_match($regex, $statement, $matches, PREG_OFFSET_CAPTURE, $offset)) {
$offset = $matches[0][1];

return $matches[0][0];
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public function quote($value, $type = ParameterType::STRING)
{
if (is_int($value)) {
return $value;
} elseif (is_float($value)) {
}

if (is_float($value)) {
return sprintf('%F', $value);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Doctrine/DBAL/DriverManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ public static function getConnection(
// 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 {
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2968,7 +2968,6 @@ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
}


/**
* Obtains DBMS specific SQL to be used to create date fields in statements
* like CREATE TABLE.
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
foreach ($indexes as $definition) {
$sqls[] = $this->getCreateIndexSQL($definition, $tableName);
}

return $sqls;
}

Expand Down
8 changes: 6 additions & 2 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ private function getSequenceCacheSQL(Sequence $sequence)
{
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();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ private function convertSingleBooleanValue($value, $callback)
}

if (is_bool($value) || is_numeric($value)) {
return $callback($value ? true : false);
return $callback((bool) $value);
}

if (! is_string($value)) {
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,15 @@ public function getForeignKeyMatchClauseSQL($type)
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';
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ private function scrubInnerOrderBy($query)
$query = substr($query, 0, $orderByPos) . substr($query, $currentPosition - 1);
$offset = $orderByPos;
}

return $query;
}

Expand Down
24 changes: 14 additions & 10 deletions lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1070,12 +1070,14 @@ private function getIndexesInAlteredTable(TableDiff $diff)
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) {
Expand Down Expand Up @@ -1122,12 +1124,14 @@ private function getForeignKeysInAlteredTable(TableDiff $diff)
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) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,6 @@ public function groupBy($groupBy)
return $this->add('groupBy', $groupBy, false);
}


/**
* Adds a grouping expression to the query.
*
Expand Down Expand Up @@ -1188,6 +1187,7 @@ private function getSQLForInsert()
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']) : '');
Expand All @@ -1201,6 +1201,7 @@ private function getSQLForUpdate()
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']) : '');
}

Expand Down
Loading