From 5bb4377129a9ca7421ee3d15f16d2caa424e0cb8 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 12:42:07 +0900 Subject: [PATCH 1/2] Point the attribute docblocks to the manual --- src/Annotation/DbQuery.php | 12 +++++++++++- src/Annotation/Pager.php | 10 +++++++++- src/Annotation/Qualifier/FactoryMethod.php | 3 +++ src/Annotation/Qualifier/SqlDir.php | 3 +++ src/Annotation/SqlTemplate.php | 3 +++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Annotation/DbQuery.php b/src/Annotation/DbQuery.php index 72240924..27bdcf70 100644 --- a/src/Annotation/DbQuery.php +++ b/src/Annotation/DbQuery.php @@ -6,10 +6,20 @@ use Attribute; +/** + * Runs the SQL file of the ID with the method arguments and returns the result + * + * @see https://bearsunday.github.io/manuals/1.0/en/database_media.html#dbquery + * @see \Ray\MediaQuery\DbQueryInterceptor + */ #[Attribute(Attribute::TARGET_METHOD)] final class DbQuery { - /** @param 'row'|'row_list' $type */ + /** + * @param string $id SQL file name in the SQL directory, without `.sql` + * @param 'row'|'row_list' $type `row` returns a single row for an `array` return type + * @param string $factory Class whose factory method creates each row + */ public function __construct( public string $id, public string $type = 'row_list', diff --git a/src/Annotation/Pager.php b/src/Annotation/Pager.php index b52aa0b5..903393a3 100644 --- a/src/Annotation/Pager.php +++ b/src/Annotation/Pager.php @@ -6,10 +6,18 @@ use Attribute; +/** + * Paginates the #[DbQuery] result into a lazily queried PagesInterface + * + * @see https://bearsunday.github.io/manuals/1.0/en/database_media.html#pagination + */ #[Attribute(Attribute::TARGET_METHOD)] final class Pager { - /** @param int|string $perPage int:the number of items, string: the name of the argument of the number of items */ + /** + * @param int|string $perPage int:the number of items, string: the name of the argument of the number of items + * @param string $template URI template of the page links in the pager HTML + */ public function __construct( public int|string $perPage = 10, public string $template = '/{?page}', diff --git a/src/Annotation/Qualifier/FactoryMethod.php b/src/Annotation/Qualifier/FactoryMethod.php index e2afc02b..ded496a8 100644 --- a/src/Annotation/Qualifier/FactoryMethod.php +++ b/src/Annotation/Qualifier/FactoryMethod.php @@ -7,6 +7,9 @@ use Attribute; use Ray\Di\Di\Qualifier; +/** + * Qualifies the name of the method called on the `factory` class of #[DbQuery] + */ #[Attribute(Attribute::TARGET_PARAMETER)] #[Qualifier] final class FactoryMethod diff --git a/src/Annotation/Qualifier/SqlDir.php b/src/Annotation/Qualifier/SqlDir.php index a968855f..36f9cd2a 100644 --- a/src/Annotation/Qualifier/SqlDir.php +++ b/src/Annotation/Qualifier/SqlDir.php @@ -7,6 +7,9 @@ use Attribute; use Ray\Di\Di\Qualifier; +/** + * Qualifies the path of the directory that holds the SQL files + */ #[Attribute(Attribute::TARGET_PARAMETER)] #[Qualifier] final class SqlDir diff --git a/src/Annotation/SqlTemplate.php b/src/Annotation/SqlTemplate.php index 44aafb36..1091b3b1 100644 --- a/src/Annotation/SqlTemplate.php +++ b/src/Annotation/SqlTemplate.php @@ -6,6 +6,9 @@ use Attribute; +/** + * Qualifies the template that wraps each executed SQL with its query ID for the SQL log + */ #[Attribute(Attribute::TARGET_PARAMETER)] final class SqlTemplate { From 45d00337473a6b865db31548ccaa5e3f262afffc Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 17 Nov 2026 13:36:34 +0900 Subject: [PATCH 2/2] Keep SqlTemplate out of the docblock change --- src/Annotation/SqlTemplate.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Annotation/SqlTemplate.php b/src/Annotation/SqlTemplate.php index 1091b3b1..44aafb36 100644 --- a/src/Annotation/SqlTemplate.php +++ b/src/Annotation/SqlTemplate.php @@ -6,9 +6,6 @@ use Attribute; -/** - * Qualifies the template that wraps each executed SQL with its query ID for the SQL log - */ #[Attribute(Attribute::TARGET_PARAMETER)] final class SqlTemplate {