diff --git a/CHANGELOG.md b/CHANGELOG.md index c38e9aee1a..0dd75ebd06 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated ### Removed ### Fixed +* Fix types order in `Elastica\Query` to work with psalm & expand the `aggs` type to include raw arrays ### Security ## [7.3.0](https://github.com/ruflin/Elastica/compare/7.3.0...7.2.0) diff --git a/src/Query.php b/src/Query.php index e4d64eab3c..c4ce92ffb6 100644 --- a/src/Query.php +++ b/src/Query.php @@ -20,11 +20,26 @@ * @author Nicolas Ruflin * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html - * @phpstan-type TCreateQueryArgs = TCreateQueryArgsMatching|AbstractSuggest|Collapse|Suggest - * @phpstan-type TCreateQueryArgsMatching = AbstractQuery|TRawQuery|self|string|null + * @todo: improve THighlightArgs https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html + * @phpstan-type THighlightArgs = array + * @phpstan-type TStoredFields = list + * @todo: improve TDocValueFields https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-docvalue-fields + * @phpstan-type TDocValueFields = array + * @phpstan-type TRescoreArgs = QueryRescore|list + * @phpstan-type TSourceArgs = non-empty-string|list|array{includes?: list, excludes?: list}|false + * @phpstan-type TSortArrayArg = array|array, max_children?: int, nested?: array}, + * missing?: non-empty-string, + * unmapped_type?: non-empty-string, + * }>|array{_geo_distance: array} + * @phpstan-type TSortArg = non-empty-string|TSortArrayArg + * @phpstan-type TSortArgs = list|TSortArrayArg * @phpstan-type TRawQuery = array{ * _source?: TSourceArgs, - * aggs?: list, + * aggs?: list|array>>, * collapse?: Collapse, * docvalue_fields?: TDocValueFields, * explain?: bool, @@ -46,23 +61,8 @@ * track_total_hits?: bool|int, * version?: bool, * } - * @phpstan-type TSortArgs = list|TSortArrayArg - * @phpstan-type TSortArg = non-empty-string|TSortArrayArg - * @phpstan-type TSortArrayArg = array|array, max_children?: int, nested?: array}, - * missing?: non-empty-string, - * unmapped_type?: non-empty-string, - * }>|array{_geo_distance: array} - * @todo: improve THighlightArgs https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html - * @phpstan-type THighlightArgs = array - * @phpstan-type TStoredFields = list - * @todo: improve TDocValueFields https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-docvalue-fields - * @phpstan-type TDocValueFields = array - * @phpstan-type TRescoreArgs = QueryRescore|list - * @phpstan-type TSourceArgs = non-empty-string|list|array{includes?: list, excludes?: list}|false + * @phpstan-type TCreateQueryArgsMatching = AbstractQuery|TRawQuery|self|string|null + * @phpstan-type TCreateQueryArgs = TCreateQueryArgsMatching|AbstractSuggest|Collapse|Suggest */ class Query extends Param {