diff --git a/tests/PHPStan/Analyser/nsrt/pr-5379.php b/tests/PHPStan/Analyser/nsrt/pr-5379.php new file mode 100644 index 00000000000..e3f9a47efac --- /dev/null +++ b/tests/PHPStan/Analyser/nsrt/pr-5379.php @@ -0,0 +1,37 @@ + $aggregation + */ + private function parseAggregation(array $aggregation) + { + $type = $aggregation['type'] ?? null; + if (!\is_string($type) || empty($type) || is_numeric($type)) { + return null; + } + + if (empty($aggregation['field']) && $type !== 'filter') { + return null; + } + + $field = ''; + if ($type !== 'filter') { + $field = self::buildFieldName(); + } + + assertType('non-falsy-string', $type); + } + + private static function buildFieldName(): string + { + return 'field'; + } +}