Skip to content

Commit a24b89d

Browse files
authored
Merge pull request #5624 from greg0ire/cs-update
Upgrade to doctrine/coding-standard 10
2 parents dfc38cd + ec507e2 commit a24b89d

File tree

322 files changed

+1828
-2862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+1828
-2862
lines changed

bin/doctrine-dbal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
STDERR,
77
'[Warning] The use of this script is discouraged.'
88
. ' You find instructions on how to boostrap the console runner in our documentation.'
9-
. PHP_EOL
9+
. PHP_EOL,
1010
);
1111

1212
echo PHP_EOL . PHP_EOL;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"psr/log": "^1|^2|^3"
4141
},
4242
"require-dev": {
43-
"doctrine/coding-standard": "9.0.2",
43+
"doctrine/coding-standard": "10.0.0",
4444
"jetbrains/phpstorm-stubs": "2022.2",
4545
"phpstan/phpstan": "1.8.2",
4646
"phpstan/phpstan-strict-rules": "^1.3",

src/ArrayParameters/Exception.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
use Throwable;
66

7-
/**
8-
* @internal
9-
*/
7+
/** @internal */
108
interface Exception extends Throwable
119
{
1210
}

src/ArrayParameters/Exception/MissingNamedParameter.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77

88
use function sprintf;
99

10-
/**
11-
* @psalm-immutable
12-
*/
10+
/** @psalm-immutable */
1311
class MissingNamedParameter extends LogicException implements Exception
1412
{
1513
public static function new(string $name): self
1614
{
1715
return new self(
18-
sprintf('Named parameter "%s" does not have a bound value.', $name)
16+
sprintf('Named parameter "%s" does not have a bound value.', $name),
1917
);
2018
}
2119
}

src/ArrayParameters/Exception/MissingPositionalParameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MissingPositionalParameter extends LogicException implements Exception
1717
public static function new(int $index): self
1818
{
1919
return new self(
20-
sprintf('Positional parameter at index %d does not have a bound value.', $index)
20+
sprintf('Positional parameter at index %d does not have a bound value.', $index),
2121
);
2222
}
2323
}

src/Cache/ArrayResult.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
use function count;
1010
use function reset;
1111

12-
/**
13-
* @internal The class is internal to the caching layer implementation.
14-
*/
12+
/** @internal The class is internal to the caching layer implementation. */
1513
final class ArrayResult implements Result
1614
{
1715
/** @var list<array<string, mixed>> */
@@ -20,9 +18,7 @@ final class ArrayResult implements Result
2018
private int $columnCount = 0;
2119
private int $num = 0;
2220

23-
/**
24-
* @param list<array<string, mixed>> $data
25-
*/
21+
/** @param list<array<string, mixed>> $data */
2622
public function __construct(array $data)
2723
{
2824
$this->data = $data;
@@ -108,9 +104,7 @@ public function free(): void
108104
$this->data = [];
109105
}
110106

111-
/**
112-
* @return array<string, mixed>|false
113-
*/
107+
/** @return array<string, mixed>|false */
114108
private function fetch()
115109
{
116110
if (! isset($this->data[$this->num])) {

src/Cache/CacheException.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@
44

55
use Doctrine\DBAL\Exception;
66

7-
/**
8-
* @psalm-immutable
9-
*/
7+
/** @psalm-immutable */
108
class CacheException extends Exception
119
{
12-
/**
13-
* @return CacheException
14-
*/
10+
/** @return CacheException */
1511
public static function noCacheKey()
1612
{
1713
return new self('No cache key was set.');
1814
}
1915

20-
/**
21-
* @return CacheException
22-
*/
16+
/** @return CacheException */
2317
public static function noResultDriverConfigured()
2418
{
2519
return new self('Trying to cache a query but no result driver is configured.');

src/Cache/QueryCacheProfile.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct($lifetime = 0, $cacheKey = null, ?object $resultCach
4949
'Passing an instance of %s to %s as $resultCache is deprecated. Pass an instance of %s instead.',
5050
Cache::class,
5151
__METHOD__,
52-
CacheItemPoolInterface::class
52+
CacheItemPoolInterface::class,
5353
);
5454

5555
$this->resultCache = CacheAdapter::wrap($resultCache);
@@ -58,7 +58,7 @@ public function __construct($lifetime = 0, $cacheKey = null, ?object $resultCach
5858
'$resultCache: Expected either null or an instance of %s or %s, got %s.',
5959
CacheItemPoolInterface::class,
6060
Cache::class,
61-
get_class($resultCache)
61+
get_class($resultCache),
6262
));
6363
}
6464
}
@@ -79,15 +79,13 @@ public function getResultCacheDriver()
7979
'doctrine/dbal',
8080
'https://github.com/doctrine/dbal/pull/4620',
8181
'%s is deprecated, call getResultCache() instead.',
82-
__METHOD__
82+
__METHOD__,
8383
);
8484

8585
return $this->resultCache !== null ? DoctrineProvider::wrap($this->resultCache) : null;
8686
}
8787

88-
/**
89-
* @return int
90-
*/
88+
/** @return int */
9189
public function getLifetime()
9290
{
9391
return $this->lifetime;
@@ -154,7 +152,7 @@ public function setResultCacheDriver(Cache $cache)
154152
'doctrine/dbal',
155153
'https://github.com/doctrine/dbal/pull/4620',
156154
'%s is deprecated, call setResultCache() instead.',
157-
__METHOD__
155+
__METHOD__,
158156
);
159157

160158
return new QueryCacheProfile($this->lifetime, $this->cacheKey, CacheAdapter::wrap($cache));

src/Configuration.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function setSQLLogger(?SQLLogger $logger = null): void
7373
'doctrine/dbal',
7474
'https://github.com/doctrine/dbal/pull/4967',
7575
'%s is deprecated, use setMiddlewares() and Logging\\Middleware instead.',
76-
__METHOD__
76+
__METHOD__,
7777
);
7878

7979
$this->sqlLogger = $logger;
@@ -90,7 +90,7 @@ public function getSQLLogger(): ?SQLLogger
9090
'doctrine/dbal',
9191
'https://github.com/doctrine/dbal/pull/4967',
9292
'%s is deprecated.',
93-
__METHOD__
93+
__METHOD__,
9494
);
9595

9696
return $this->sqlLogger;
@@ -115,7 +115,7 @@ public function getResultCacheImpl(): ?Cache
115115
'doctrine/dbal',
116116
'https://github.com/doctrine/dbal/pull/4620',
117117
'%s is deprecated, call getResultCache() instead.',
118-
__METHOD__
118+
__METHOD__,
119119
);
120120

121121
return $this->resultCacheImpl;
@@ -141,7 +141,7 @@ public function setResultCacheImpl(Cache $cacheImpl): void
141141
'doctrine/dbal',
142142
'https://github.com/doctrine/dbal/pull/4620',
143143
'%s is deprecated, call setResultCache() instead.',
144-
__METHOD__
144+
__METHOD__,
145145
);
146146

147147
$this->resultCacheImpl = $cacheImpl;
@@ -158,7 +158,7 @@ public function setSchemaAssetsFilter(?callable $callable = null): void
158158
'doctrine/dbal',
159159
'https://github.com/doctrine/dbal/pull/5483',
160160
'Not passing an argument to %s is deprecated.',
161-
__METHOD__
161+
__METHOD__,
162162
);
163163
} elseif ($callable === null) {
164164
Deprecation::trigger(
@@ -220,9 +220,7 @@ public function setMiddlewares(array $middlewares): self
220220
return $this;
221221
}
222222

223-
/**
224-
* @return Middleware[]
225-
*/
223+
/** @return Middleware[] */
226224
public function getMiddlewares(): array
227225
{
228226
return $this->middlewares;

src/Connection.php

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function getExpressionBuilder()
294294
'doctrine/dbal',
295295
'https://github.com/doctrine/dbal/issues/4515',
296296
'Connection::getExpressionBuilder() is deprecated,'
297-
. ' use Connection::createExpressionBuilder() instead.'
297+
. ' use Connection::createExpressionBuilder() instead.',
298298
);
299299

300300
return $this->_expr;
@@ -315,7 +315,7 @@ public function connect()
315315
Deprecation::triggerIfCalledFromOutside(
316316
'doctrine/dbal',
317317
'https://github.com/doctrine/dbal/issues/4966',
318-
'Public access to Connection::connect() is deprecated.'
318+
'Public access to Connection::connect() is deprecated.',
319319
);
320320

321321
if ($this->_conn !== null) {
@@ -445,7 +445,7 @@ private function getServerVersion()
445445
'doctrine/dbal',
446446
'https://github.com/doctrine/dbal/pulls/4750',
447447
'Not implementing the ServerInfoAwareConnection interface in %s is deprecated',
448-
get_class($connection)
448+
get_class($connection),
449449
);
450450

451451
// Unable to detect platform version.
@@ -626,7 +626,7 @@ public function delete($table, array $criteria, array $types = [])
626626
return $this->executeStatement(
627627
'DELETE FROM ' . $table . ' WHERE ' . implode(' AND ', $conditions),
628628
$values,
629-
is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types
629+
is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types,
630630
);
631631
}
632632

@@ -738,7 +738,7 @@ public function insert($table, array $data, array $types = [])
738738
'INSERT INTO ' . $table . ' (' . implode(', ', $columns) . ')' .
739739
' VALUES (' . implode(', ', $set) . ')',
740740
$values,
741-
is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types
741+
is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types,
742742
);
743743
}
744744

@@ -1172,7 +1172,7 @@ public function lastInsertId($name = null)
11721172
Deprecation::trigger(
11731173
'doctrine/dbal',
11741174
'https://github.com/doctrine/dbal/issues/4687',
1175-
'The usage of Connection::lastInsertId() with a sequence name is deprecated.'
1175+
'The usage of Connection::lastInsertId() with a sequence name is deprecated.',
11761176
);
11771177
}
11781178

@@ -1233,7 +1233,7 @@ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoint
12331233
Nesting transactions without enabling savepoints is deprecated.
12341234
Call %s::setNestTransactionsWithSavepoints(true) to enable savepoints.
12351235
DEPRECATION,
1236-
self::class
1236+
self::class,
12371237
);
12381238
}
12391239

@@ -1308,7 +1308,7 @@ public function beginTransaction()
13081308
Nesting transactions without enabling savepoints is deprecated.
13091309
Call %s::setNestTransactionsWithSavepoints(true) to enable savepoints.
13101310
DEPRECATION,
1311-
self::class
1311+
self::class,
13121312
);
13131313
}
13141314

@@ -1523,7 +1523,7 @@ public function getWrappedConnection()
15231523
'doctrine/dbal',
15241524
'https://github.com/doctrine/dbal/issues/4966',
15251525
'Connection::getWrappedConnection() is deprecated.'
1526-
. ' Use Connection::getNativeConnection() to access the native connection.'
1526+
. ' Use Connection::getNativeConnection() to access the native connection.',
15271527
);
15281528

15291529
$this->connect();
@@ -1533,9 +1533,7 @@ public function getWrappedConnection()
15331533
return $this->_conn;
15341534
}
15351535

1536-
/**
1537-
* @return resource|object
1538-
*/
1536+
/** @return resource|object */
15391537
public function getNativeConnection()
15401538
{
15411539
$this->connect();
@@ -1544,7 +1542,7 @@ public function getNativeConnection()
15441542
if (! method_exists($this->_conn, 'getNativeConnection')) {
15451543
throw new LogicException(sprintf(
15461544
'The driver connection %s does not support accessing the native connection.',
1547-
get_class($this->_conn)
1545+
get_class($this->_conn),
15481546
));
15491547
}
15501548

@@ -1561,7 +1559,7 @@ public function createSchemaManager(): AbstractSchemaManager
15611559
{
15621560
return $this->_driver->getSchemaManager(
15631561
$this,
1564-
$this->getDatabasePlatform()
1562+
$this->getDatabasePlatform(),
15651563
);
15661564
}
15671565

@@ -1580,7 +1578,7 @@ public function getSchemaManager()
15801578
Deprecation::triggerIfCalledFromOutside(
15811579
'doctrine/dbal',
15821580
'https://github.com/doctrine/dbal/issues/4515',
1583-
'Connection::getSchemaManager() is deprecated, use Connection::createSchemaManager() instead.'
1581+
'Connection::getSchemaManager() is deprecated, use Connection::createSchemaManager() instead.',
15841582
);
15851583

15861584
return $this->_schemaManager ??= $this->createSchemaManager();
@@ -1677,7 +1675,7 @@ private function bindParameters(DriverStatement $stmt, array $params, array $typ
16771675
'doctrine/dbal',
16781676
'https://github.com/doctrine/dbal/pull/5550',
16791677
'Using NULL as prepared statement parameter type is deprecated.'
1680-
. 'Omit or use Parameter::STRING instead'
1678+
. 'Omit or use Parameter::STRING instead',
16811679
);
16821680
}
16831681

@@ -1700,7 +1698,7 @@ private function bindParameters(DriverStatement $stmt, array $params, array $typ
17001698
'doctrine/dbal',
17011699
'https://github.com/doctrine/dbal/pull/5550',
17021700
'Using NULL as prepared statement parameter type is deprecated.'
1703-
. 'Omit or use Parameter::STRING instead'
1701+
. 'Omit or use Parameter::STRING instead',
17041702
);
17051703
}
17061704

@@ -1763,9 +1761,7 @@ final public function convertExceptionDuringQuery(
17631761
return $this->handleDriverException($e, new Query($sql, $params, $types));
17641762
}
17651763

1766-
/**
1767-
* @internal
1768-
*/
1764+
/** @internal */
17691765
final public function convertException(Driver\Exception $e): DriverException
17701766
{
17711767
return $this->handleDriverException($e, null);

0 commit comments

Comments
 (0)