From 4aba67d00e0ff7f3fa4ea8d24214a37c87390c0f Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 12:42:26 +0900 Subject: [PATCH 1/4] Point the attribute docblocks to the manual --- src/Annotation/Qualifier/UriTemplateBindings.php | 3 +++ src/Annotation/Qualifier/WebApiList.php | 3 +++ src/Annotation/WebQuery.php | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/src/Annotation/Qualifier/UriTemplateBindings.php b/src/Annotation/Qualifier/UriTemplateBindings.php index 14ff507..41cdf74 100644 --- a/src/Annotation/Qualifier/UriTemplateBindings.php +++ b/src/Annotation/Qualifier/UriTemplateBindings.php @@ -7,6 +7,9 @@ use Attribute; use Ray\Di\Di\Qualifier; +/** + * Qualifies the values expanded into the URI templates of every web API + */ #[Attribute(Attribute::TARGET_PARAMETER)] #[Qualifier] final class UriTemplateBindings diff --git a/src/Annotation/Qualifier/WebApiList.php b/src/Annotation/Qualifier/WebApiList.php index daf4189..6a5600c 100644 --- a/src/Annotation/Qualifier/WebApiList.php +++ b/src/Annotation/Qualifier/WebApiList.php @@ -7,6 +7,9 @@ use Attribute; use Ray\Di\Di\Qualifier; +/** + * Qualifies the method and path of each web API, keyed by its id + */ #[Attribute(Attribute::TARGET_PARAMETER)] #[Qualifier] final class WebApiList diff --git a/src/Annotation/WebQuery.php b/src/Annotation/WebQuery.php index 739b855..67eb370 100644 --- a/src/Annotation/WebQuery.php +++ b/src/Annotation/WebQuery.php @@ -6,9 +6,19 @@ use Attribute; +/** + * Calls the web API registered under `id` with the method arguments and maps the response to the return type + * + * @see \Ray\MediaQuery\WebQueryInterceptor + */ #[Attribute(Attribute::TARGET_METHOD)] final class WebQuery { + /** + * @param string $id `id` of an entry in the `webQuery` list of the media query JSON + * @param string $type `row` maps the response to one object, `row_list` to a list + * @param string $factory Class whose `factory()` method builds each row, resolved through the injector + */ public function __construct( public string $id, public string $type = 'row_list', From 96b6e1e1fa3f1932708f5b67bba5888043ee4618 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 13:36:53 +0900 Subject: [PATCH 2/4] Describe when WebQuery reads type and how it calls the factory --- src/Annotation/WebQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Annotation/WebQuery.php b/src/Annotation/WebQuery.php index 67eb370..07de2b3 100644 --- a/src/Annotation/WebQuery.php +++ b/src/Annotation/WebQuery.php @@ -16,8 +16,8 @@ final class WebQuery { /** * @param string $id `id` of an entry in the `webQuery` list of the media query JSON - * @param string $type `row` maps the response to one object, `row_list` to a list - * @param string $factory Class whose `factory()` method builds each row, resolved through the injector + * @param string $type `row` returns one object for an `array` return type; read only with a factory or an entity + * @param string $factory Class whose `factory()` builds each row; a non-static one is created by the injector */ public function __construct( public string $id, From 58055181037585883bea840c3cc57c6a6078457c Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 16:08:07 +0900 Subject: [PATCH 3/4] Describe how the return type shapes the WebQuery result and calls the factory --- src/Annotation/WebQuery.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Annotation/WebQuery.php b/src/Annotation/WebQuery.php index 07de2b3..2631e19 100644 --- a/src/Annotation/WebQuery.php +++ b/src/Annotation/WebQuery.php @@ -16,8 +16,11 @@ final class WebQuery { /** * @param string $id `id` of an entry in the `webQuery` list of the media query JSON - * @param string $type `row` returns one object for an `array` return type; read only with a factory or an entity - * @param string $factory Class whose `factory()` builds each row; a non-static one is created by the injector + * @param string $type `row` maps the response to one object; `row_list` maps it to a list for an `array` + * or PostFetchInterface return type and to one object for another class or a union. + * Read only with a factory or an entity. + * @param string $factory Class whose `factory()` builds each row; a static `factory()` is called directly, + * a non-static one on an instance from the injector */ public function __construct( public string $id, From 2d97360eea63e0b294c0678513eb719e74b6fe3c Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 17:07:27 +0900 Subject: [PATCH 4/4] State that an empty response maps to null for one object --- src/Annotation/WebQuery.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Annotation/WebQuery.php b/src/Annotation/WebQuery.php index 2631e19..c6e7b71 100644 --- a/src/Annotation/WebQuery.php +++ b/src/Annotation/WebQuery.php @@ -18,6 +18,7 @@ final class WebQuery * @param string $id `id` of an entry in the `webQuery` list of the media query JSON * @param string $type `row` maps the response to one object; `row_list` maps it to a list for an `array` * or PostFetchInterface return type and to one object for another class or a union. + * Where one object is mapped, an empty response gives null. * Read only with a factory or an entity. * @param string $factory Class whose `factory()` builds each row; a static `factory()` is called directly, * a non-static one on an instance from the injector