Skip to content

Commit

Permalink
Merge pull request #4663 from derrabus/bump/cs
Browse files Browse the repository at this point in the history
Bump doctrine/coding-standard
  • Loading branch information
morozov committed Jun 5, 2021
2 parents 2c19354 + ce7db44 commit 2f286f4
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 52 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -39,7 +39,7 @@
"doctrine/event-manager": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "8.2.0",
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2020.2",
"phpstan/phpstan": "0.12.81",
"phpunit/phpunit": "^7.5.20|^8.5|9.5.0",
Expand Down
20 changes: 9 additions & 11 deletions lib/Doctrine/DBAL/Connection.php
Expand Up @@ -178,11 +178,10 @@ class Connection implements DriverConnection
* @param Driver $driver The driver to use.
* @param Configuration|null $config The configuration, optional.
* @param EventManager|null $eventManager The event manager, optional.
* @psalm-param Params $params
* @phpstan-param array<string,mixed> $params
*
* @throws Exception
*
* @phpstan-param array<string,mixed> $params
* @psalm-param Params $params
*/
public function __construct(
array $params,
Expand Down Expand Up @@ -229,9 +228,8 @@ public function __construct(
* @internal
*
* @return array<string,mixed>
*
* @phpstan-return array<string,mixed>
* @psalm-return Params
* @phpstan-return array<string,mixed>
*/
public function getParams()
{
Expand Down Expand Up @@ -2200,9 +2198,9 @@ public function ping()
* @param array<int, mixed>|array<string, mixed> $params
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
*
* @throws Exception
*
* @psalm-return never-return
*
* @throws Exception
*/
public function handleExceptionDuringQuery(Throwable $e, string $sql, array $params = [], array $types = []): void
{
Expand All @@ -2219,9 +2217,9 @@ public function handleExceptionDuringQuery(Throwable $e, string $sql, array $par
/**
* @internal
*
* @throws Exception
*
* @psalm-return never-return
*
* @throws Exception
*/
public function handleDriverException(Throwable $e): void
{
Expand All @@ -2236,9 +2234,9 @@ public function handleDriverException(Throwable $e): void
/**
* @internal
*
* @throws Exception
*
* @psalm-return never-return
*
* @throws Exception
*/
private function throw(Exception $e): void
{
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
Expand Up @@ -5,13 +5,14 @@
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

/**
* @deprecated Use PrimaryReadReplicaConnection instead
*
* @psalm-import-type Params from \Doctrine\DBAL\DriverManager
* @psalm-import-type Params from DriverManager
*/
class MasterSlaveConnection extends PrimaryReadReplicaConnection
{
Expand All @@ -21,11 +22,10 @@ class MasterSlaveConnection extends PrimaryReadReplicaConnection
* @internal The connection can be only instantiated by the driver manager.
*
* @param array<string,mixed> $params
* @psalm-param Params $params
* @phpstan-param array<string,mixed> $params
*
* @throws InvalidArgumentException
*
* @phpstan-param array<string,mixed> $params
* @psalm-param Params $params
*/
public function __construct(
array $params,
Expand Down
Expand Up @@ -7,6 +7,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events;
use InvalidArgumentException;
Expand Down Expand Up @@ -56,7 +57,7 @@
*
* Instantiation through the DriverManager looks like:
*
* @psalm-import-type Params from \Doctrine\DBAL\DriverManager
* @psalm-import-type Params from DriverManager
* @example
*
* $conn = DriverManager::getConnection(array(
Expand Down Expand Up @@ -95,11 +96,10 @@ class PrimaryReadReplicaConnection extends Connection
* @internal The connection can be only instantiated by the driver manager.
*
* @param array<string,mixed> $params
* @psalm-param Params $params
* @phpstan-param array<string,mixed> $params
*
* @throws InvalidArgumentException
*
* @phpstan-param array<string,mixed> $params
* @psalm-param Params $params
*/
public function __construct(
array $params,
Expand Down
23 changes: 11 additions & 12 deletions lib/Doctrine/DBAL/DriverManager.php
Expand Up @@ -156,10 +156,6 @@ private function __construct()
* @param array<string,mixed> $params
* @param Configuration|null $config The configuration to use.
* @param EventManager|null $eventManager The event manager to use.
*
* @throws Exception
*
* @phpstan-param array<string,mixed> $params
* @psalm-param array{
* charset?: string,
* dbname?: string,
Expand All @@ -184,7 +180,12 @@ private function __construct()
* user?: string,
* wrapperClass?: class-string<T>,
* } $params
* @phpstan-param array<string,mixed> $params
*
* @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection)
*
* @throws Exception
*
* @template T of Connection
*/
public static function getConnection(
Expand Down Expand Up @@ -281,11 +282,10 @@ public static function getAvailableDrivers(): array

/**
* @param array<string,mixed> $params
* @psalm-param Params $params
* @phpstan-param array<string,mixed> $params
*
* @throws Exception
*
* @phpstan-param array<string,mixed> $params
* @psalm-param Params $params
*/
private static function createDriver(array $params): Driver
{
Expand Down Expand Up @@ -328,16 +328,15 @@ private static function normalizeDatabaseUrlPath(string $urlPath): string
* updated list of parameters.
*
* @param mixed[] $params The list of parameters.
* @psalm-param Params $params
* @phpstan-param array<string,mixed> $params
*
* @return mixed[] A modified list of parameters with info from a database
* URL extracted into indidivual parameter parts.
* @psalm-return Params
* @phpstan-return array<string,mixed>
*
* @throws Exception
*
* @phpstan-param array<string,mixed> $params
* @phpstan-return array<string,mixed>
* @psalm-param Params $params
* @psalm-return Params
*/
private static function parseDatabaseUrl(array $params): array
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Expand Up @@ -3658,10 +3658,9 @@ final public function getReservedKeywordsList()
* Returns the class name of the reserved keywords list.
*
* @return string
* @psalm-return class-string<KeywordList>
*
* @throws Exception If not supported on this platform.
*
* @psalm-return class-string<KeywordList>
*/
protected function getReservedKeywordsClass()
{
Expand Down
9 changes: 0 additions & 9 deletions phpcs.xml.dist
Expand Up @@ -76,10 +76,6 @@
<exclude-pattern>lib/Doctrine/DBAL/Events.php</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedProperty">
<exclude-pattern>tests/Doctrine/Tests/DBAL/Tools/TestAsset/*</exclude-pattern>
</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>
Expand Down Expand Up @@ -125,11 +121,6 @@
<exclude-pattern>lib/Doctrine/DBAL/Driver/PDOConnection.php</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod">
<exclude-pattern>*/lib/Doctrine/DBAL/Driver/PDOConnection.php</exclude-pattern>
<exclude-pattern>*/lib/Doctrine/DBAL/Driver/PDOStatement.php</exclude-pattern>
</rule>

<!-- See https://github.com/slevomat/coding-standard/issues/770 -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<exclude-pattern>lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php</exclude-pattern>
Expand Down
3 changes: 1 addition & 2 deletions tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
Expand Up @@ -352,10 +352,9 @@ public function testConnectionExceptionSqLite(): void

/**
* @param array<string, mixed> $params
* @psalm-param Params $params
*
* @dataProvider getConnectionParams
*
* @psalm-param Params $params
*/
public function testConnectionException(array $params): void
{
Expand Down
Expand Up @@ -15,7 +15,7 @@
use const CASE_LOWER;

/**
* @psalm-import-type Params from \Doctrine\DBAL\DriverManager
* @psalm-import-type Params from DriverManager
*/
class MasterSlaveConnectionTest extends DbalFunctionalTestCase
{
Expand Down Expand Up @@ -55,7 +55,6 @@ private function createMasterSlaveConnection(bool $keepSlave = false): MasterSla

/**
* @return mixed[]
*
* @psalm-return Params
*/
private function createMasterSlaveConnectionParams(bool $keepSlave = false): array
Expand Down
Expand Up @@ -16,7 +16,7 @@

/**
* @group DBAL-20
* @psalm-import-type Params from \Doctrine\DBAL\DriverManager
* @psalm-import-type Params from DriverManager
*/
class PrimaryReadReplicaConnectionTest extends DbalFunctionalTestCase
{
Expand Down Expand Up @@ -56,7 +56,6 @@ private function createPrimaryReadReplicaConnection(bool $keepReplica = false):

/**
* @return mixed[]
*
* @psalm-return Params
*/
private function createPrimaryReadReplicaConnectionParams(bool $keepReplica = false): array
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php
Expand Up @@ -8,6 +8,7 @@
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
Expand All @@ -18,7 +19,7 @@
use function array_merge;

/**
* @psalm-import-type Params from \Doctrine\DBAL\DriverManager
* @psalm-import-type Params from DriverManager
*/
class MySqlInheritCharsetTest extends TestCase
{
Expand Down Expand Up @@ -77,10 +78,9 @@ public function testTableOptions(): void

/**
* @param array<string,mixed> $params
* @psalm-param Params $params
*
* @return string[]
*
* @psalm-param Params $params
*/
private function getTableOptionsForOverride(array $params = []): array
{
Expand Down

0 comments on commit 2f286f4

Please sign in to comment.