We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1c5ab45 commit f3a5c6fCopy full SHA for f3a5c6f
1 file changed
tests/PHPStan/Analyser/nsrt/pr-5379.php
@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
5
+namespace PR5379;
6
7
+use function PHPStan\Testing\assertType;
8
9
+class AggregationParser
10
+{
11
+ /**
12
+ * @param array<string, mixed> $aggregation
13
+ */
14
+ private function parseAggregation(array $aggregation)
15
+ {
16
+ $type = $aggregation['type'] ?? null;
17
+ if (!\is_string($type) || empty($type) || is_numeric($type)) {
18
+ return null;
19
+ }
20
21
+ if (empty($aggregation['field']) && $type !== 'filter') {
22
23
24
25
+ $field = '';
26
+ if ($type !== 'filter') {
27
+ $field = self::buildFieldName();
28
29
30
+ assertType('non-empty-string', $type);
31
32
33
+ private static function buildFieldName(): string
34
35
+ return 'field';
36
37
+}
38
0 commit comments