Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BC break] Add annotation type to specify return type #30

Merged
merged 2 commits into from
May 26, 2022
Merged

[BC break] Add annotation type to specify return type #30

merged 2 commits into from
May 26, 2022

Conversation

koriym
Copy link
Member

@koriym koriym commented Apr 26, 2022

今までidのpostfixで指定していたDBフェッチの戻り値、row, row_listをアノテーションまたはアトリビュートのtypeで指定します。

アノテーションの場合:

interface TodoItemInterface
{
    /**
     * @DbQuery("todo_item", type="row")
     * @return array{id: string, title: string}
     */
    public function __invoke(string $id): array;
}

アトリビュートの場合:

interface TodoItemInterface
{
    #[DbQuery('todo_item', type: "row")]
    /**
     * @return array{id: string, title: string}
     */
    public function __invoke(string $id): array;
}
  • デフォルトはrow_listです。
  • 値を返さないexecも利用可能です。

後方互換性を破壊するので0.9としてリリースします。

@koriym koriym requested a review from NaokiTsuchiya May 25, 2022 06:05
@koriym koriym merged commit f72320e into 1.x May 26, 2022
@koriym koriym deleted the type branch May 26, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants