File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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+ return null ;
23+ }
24+
25+ $ field = '' ;
26+ if ($ type !== 'filter ' ) {
27+ $ field = self ::buildFieldName ();
28+ }
29+
30+ assertType ('non-falsy-string ' , $ type );
31+ }
32+
33+ private static function buildFieldName (): string
34+ {
35+ return 'field ' ;
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments