Skip to content

Commit ec2700b

Browse files
committed
feat: define type GroupedQueriesType and resolve return.type
1 parent 1a61917 commit ec2700b

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ parameters:
1010
ignoreErrors:
1111
- identifier: 'assign.propertyType'
1212
path: src/DataCollector/DoctrineDataCollector.php
13-
- identifier: 'return.type'
14-
path: src/DataCollector/DoctrineDataCollector.php
1513
- identifier: 'class.notFound'
1614
path: src/DependencyInjection/Configuration.php

src/DataCollector/DoctrineDataCollector.php

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
* }>>,
4747
* entityCounts: array<string, array<class-string, int>>
4848
* }
49+
* @phpstan-type GroupedQueriesType = array<string, list<array{
50+
* executionMS: float,
51+
* explainable: bool,
52+
* sql: string,
53+
* params: ?array<array-key, mixed>,
54+
* runnable: bool,
55+
* types: ?array<array-key, Type|int|string|null>,
56+
* count: int,
57+
* index: int,
58+
* executionPercent?: float
59+
* }>>
4960
* @psalm-property DataType $data
5061
*/
5162
class DoctrineDataCollector extends BaseCollector
@@ -56,17 +67,7 @@ class DoctrineDataCollector extends BaseCollector
5667

5768
/**
5869
* @var mixed[][]|null
59-
* @phpstan-var ?array<string, list<array{
60-
* executionMS: float,
61-
* explainable: bool,
62-
* sql: string,
63-
* params: ?array<array-key, mixed>,
64-
* runnable: bool,
65-
* types: ?array<array-key, Type|int|string|null>,
66-
* count: int,
67-
* index: int,
68-
* executionPercent?: float
69-
* }>>
70+
* @phpstan-var ?GroupedQueriesType
7071
*/
7172
private array|null $groupedQueries = null;
7273

@@ -269,17 +270,7 @@ public function getManagedEntityCountByClass(): array
269270

270271
/**
271272
* @return string[][]
272-
* @phpstan-return array<string, list<array{
273-
* executionMS: float,
274-
* explainable: bool,
275-
* sql: string,
276-
* params: ?array<array-key, mixed>,
277-
* runnable: bool,
278-
* types: ?array<array-key, Type|int|string|null>,
279-
* count: int,
280-
* index: int,
281-
* executionPercent?: float
282-
* }>>
273+
* @phpstan-return GroupedQueriesType
283274
*/
284275
public function getGroupedQueries(): array
285276
{
@@ -322,7 +313,10 @@ public function getGroupedQueries(): array
322313
}
323314
}
324315

325-
return $this->groupedQueries;
316+
$groupedQueries = $this->groupedQueries;
317+
/** @var GroupedQueriesType $groupedQueries */
318+
319+
return $groupedQueries;
326320
}
327321

328322
private function executionTimePercentage(float $executionTimeMS, float $totalExecutionTimeMS): float

0 commit comments

Comments
 (0)