Skip to content

Commit 5e71789

Browse files
authored
Merge pull request #1980 from greg0ire/require-php-84
Require PHP 8.4
2 parents c42cacd + 80bd103 commit 5e71789

36 files changed

+97
-270
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
php-version:
40-
- "8.1"
41-
- "8.2"
42-
- "8.3"
40+
- "8.4"
4341
dependencies:
4442
- "highest"
4543
stability:
@@ -52,7 +50,7 @@ jobs:
5250
# Tests the lowest set of dependencies
5351
- dependencies: "lowest"
5452
stability: "stable"
55-
php-version: "8.1"
53+
php-version: "8.4"
5654

5755
# Test LTS
5856
- symfony-require: "6.4.*"

UPGRADE-3.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Compatibility
77
Configuring caching options to use services backed by `doctrine/cache` is no
88
longer supported. Migrate to PSR-6 services instead.
99

10+
The minimum required PHP version is now 8.4.
11+
1012
Support for the following major versions of the following packages has been dropped:
1113

1214
- `doctrine/dbal` 3
@@ -73,6 +75,12 @@ You should use stop passing an event manager argument.
7375
+ $connectionFactory->createConnection($params, $config, $mappingTypes)
7476
```
7577

78+
Type declarations
79+
-----------------
80+
81+
Native type declarations have been added to all constants, properties, and
82+
methods.
83+
7684
Types
7785
-----
7886

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
],
3030
"homepage": "https://www.doctrine-project.org",
3131
"require": {
32-
"php": "^8.1",
32+
"php": "^8.4",
3333
"doctrine/dbal": "^4.0",
3434
"doctrine/persistence": "^4",
3535
"doctrine/sql-formatter": "^1.0.1",

phpcs.xml.dist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
<!-- Ignore warnings, show progress of the run and show sniff names -->
1212
<arg value="nps"/>
1313

14-
<config name="php_version" value="80100"/>
14+
<config name="php_version" value="80400"/>
1515

1616
<file>config</file>
1717
<file>src</file>
1818
<file>tests</file>
1919

2020
<rule ref="Doctrine">
2121
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
22-
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/> <!-- we can do it in doctrine-bundle 3.0-->
23-
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/> <!-- we can do it in doctrine-bundle 3.0 -->
2422
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
2523
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
2624
</rule>

src/Command/DoctrineCommand.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ public function __construct(
2121

2222
/**
2323
* Get a doctrine dbal connection by symfony name.
24-
*
25-
* @param string $name
26-
*
27-
* @return Connection
2824
*/
29-
protected function getDoctrineConnection($name)
25+
protected function getDoctrineConnection(string $name): Connection
3026
{
3127
return $this->getDoctrine()->getConnection($name);
3228
}
3329

34-
/** @return ManagerRegistry */
35-
protected function getDoctrine()
30+
protected function getDoctrine(): ManagerRegistry
3631
{
3732
return $this->doctrine;
3833
}

src/Command/DropDatabaseDoctrineCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
*/
2424
class DropDatabaseDoctrineCommand extends DoctrineCommand
2525
{
26-
public const RETURN_CODE_NOT_DROP = 1;
26+
public const int RETURN_CODE_NOT_DROP = 1;
2727

28-
public const RETURN_CODE_NO_FORCE = 2;
28+
public const int RETURN_CODE_NO_FORCE = 2;
2929

30-
/** @return void */
31-
protected function configure()
30+
protected function configure(): void
3231
{
3332
$this
3433
->setName('doctrine:database:drop')

src/ConnectionFactory.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class ConnectionFactory
2929
{
3030
/** @internal */
31-
public const DEFAULT_SCHEME_MAP = [
31+
public const array DEFAULT_SCHEME_MAP = [
3232
'db2' => 'ibm_db2',
3333
'mssql' => 'pdo_sqlsrv',
3434
'mysql' => 'pdo_mysql',
@@ -59,14 +59,12 @@ public function __construct(
5959
* @param mixed[] $params
6060
* @param array<string, string> $mappingTypes
6161
* @phpstan-param Params $params
62-
*
63-
* @return Connection
6462
*/
6563
public function createConnection(
6664
array $params,
6765
Configuration|null $config = null,
6866
array $mappingTypes = [],
69-
) {
67+
): Connection {
7068
if (! $this->initialized) {
7169
$this->initializeTypes();
7270
}

src/Controller/ProfilerController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ public function __construct(
3030
/**
3131
* Renders the profiler panel for the given token.
3232
*
33-
* @param string $token The profiler token
34-
* @param string $connectionName
35-
* @param int $query
33+
* @param string $token The profiler token
3634
*
3735
* @return Response A Response instance
3836
*/
39-
public function explainAction($token, $connectionName, $query)
37+
public function explainAction(string $token, string $connectionName, int $query): Response
4038
{
4139
$this->profiler->disable();
4240

src/DataCollector/DoctrineDataCollector.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,37 +186,33 @@ public function collect(Request $request, Response $response, Throwable|null $ex
186186
}
187187

188188
/** @return array<string, array<class-string, array{class: class-string, file: false|string, line: false|int}>> */
189-
public function getEntities()
189+
public function getEntities(): array
190190
{
191191
return $this->data['entities'];
192192
}
193193

194194
/** @return array<string, array<string, list<string>>> */
195-
public function getMappingErrors()
195+
public function getMappingErrors(): array
196196
{
197197
return $this->data['errors'];
198198
}
199199

200-
/** @return int */
201-
public function getCacheHitsCount()
200+
public function getCacheHitsCount(): int
202201
{
203202
return $this->data['caches']['counts']['hits'];
204203
}
205204

206-
/** @return int */
207-
public function getCachePutsCount()
205+
public function getCachePutsCount(): int
208206
{
209207
return $this->data['caches']['counts']['puts'];
210208
}
211209

212-
/** @return int */
213-
public function getCacheMissesCount()
210+
public function getCacheMissesCount(): int
214211
{
215212
return $this->data['caches']['counts']['misses'];
216213
}
217214

218-
/** @return bool */
219-
public function getCacheEnabled()
215+
public function getCacheEnabled(): bool
220216
{
221217
return $this->data['caches']['enabled'];
222218
}
@@ -225,19 +221,18 @@ public function getCacheEnabled()
225221
* @return array<string, array<string, int>>
226222
* @phpstan-return array<"puts"|"hits"|"misses", array<string, int>>
227223
*/
228-
public function getCacheRegions()
224+
public function getCacheRegions(): array
229225
{
230226
return $this->data['caches']['regions'];
231227
}
232228

233229
/** @return array<string, int> */
234-
public function getCacheCounts()
230+
public function getCacheCounts(): array
235231
{
236232
return $this->data['caches']['counts'];
237233
}
238234

239-
/** @return int */
240-
public function getInvalidEntityCount()
235+
public function getInvalidEntityCount(): int
241236
{
242237
return $this->invalidEntityCount ??= array_sum(array_map('count', $this->data['errors']));
243238
}
@@ -266,7 +261,7 @@ public function getManagedEntityCountByClass(): array
266261
* @return string[][]
267262
* @phpstan-return array<string, list<QueryType&array{count: int, index: int, executionPercent?: float}>>
268263
*/
269-
public function getGroupedQueries()
264+
public function getGroupedQueries(): array
270265
{
271266
if ($this->groupedQueries !== null) {
272267
return $this->groupedQueries;
@@ -319,8 +314,7 @@ private function executionTimePercentage(float $executionTimeMS, float $totalExe
319314
return $executionTimeMS / $totalExecutionTimeMS * 100;
320315
}
321316

322-
/** @return int */
323-
public function getGroupedQueryCount()
317+
public function getGroupedQueryCount(): int
324318
{
325319
$count = 0;
326320
foreach ($this->getGroupedQueries() as $connectionGroupedQueries) {

src/Dbal/BlacklistSchemaAssetFilter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ public function __construct(
1515
) {
1616
}
1717

18-
/** @param string|AbstractAsset $assetName */
19-
public function __invoke($assetName): bool
18+
public function __invoke(string|AbstractAsset $assetName): bool
2019
{
2120
if ($assetName instanceof AbstractAsset) {
2221
$assetName = $assetName->getName();

0 commit comments

Comments
 (0)