Skip to content

Update doctrine coding standard from 5.0 to 6.0 #3489

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

Merged
merged 2 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 0 additions & 8 deletions lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,28 @@ public function convertException($message, DriverException $exception)
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':
Expand All @@ -77,7 +71,6 @@ public function convertException($message, DriverException $exception)
case '1554':
case '1626':
return new Exception\SyntaxErrorException($message, $exception);

case '1044':
case '1045':
case '1046':
Expand All @@ -91,7 +84,6 @@ public function convertException($message, DriverException $exception)
case '2002':
case '2005':
return new Exception\ConnectionException($message, $exception);

case '1048':
case '1121':
case '1138':
Expand Down
8 changes: 0 additions & 8 deletions lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,22 @@ public function convertException($message, DriverException $exception)
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':
Expand Down
8 changes: 0 additions & 8 deletions lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,20 @@ public function convertException($message, DriverException $exception)
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.
Expand Down
6 changes: 0 additions & 6 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,10 @@ public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEX
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;
Expand All @@ -285,13 +282,10 @@ public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEX
}

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.');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(array $params, $username, $password, array $driverOp
$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();

Expand Down Expand Up @@ -239,7 +239,7 @@ private function setDriverOptions(array $driverOptions = [])
$exceptionMsg = "%s option '%s' with value '%s'";

foreach ($driverOptions as $option => $value) {
if ($option === static::OPTION_FLAGS) {
if ($option === self::OPTION_FLAGS) {
continue;
}

Expand Down
Loading