From 237d5156b624e9e766ad8f3c6c26c300f0efeeb9 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 25 Feb 2026 09:52:48 +0100 Subject: [PATCH] fix(ITypedQueryBuilder): Add correct return type and add note about Psalm bug Signed-off-by: provokateurin --- lib/public/DB/QueryBuilder/ITypedQueryBuilder.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/public/DB/QueryBuilder/ITypedQueryBuilder.php b/lib/public/DB/QueryBuilder/ITypedQueryBuilder.php index 93695c34d47..1901a22e749 100644 --- a/lib/public/DB/QueryBuilder/ITypedQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/ITypedQueryBuilder.php @@ -37,7 +37,9 @@ interface ITypedQueryBuilder extends IQueryBuilder { * @template NewS of string * @param NewS ...$columns The columns to select. They are not allowed to contain table names or aliases, or asterisks. Use {@see self::selectAlias()} for that. * @psalm-this-out self + * @return $this * @since 34.0.0 + * @note Psalm has a bug that prevents inferring the correct type in chained calls: https://github.com/vimeo/psalm/issues/8803. Convert the chained calls to standalone calls or switch to PHPStan, which suffered the same bug in the past, but fixed it in 2.1.5: https://github.com/phpstan/phpstan/issues/8439 */ public function selectColumns(string ...$columns): self; @@ -52,7 +54,9 @@ interface ITypedQueryBuilder extends IQueryBuilder { * @template NewS of string * @param NewS ...$columns The columns to select distinct. They are not allowed to contain table names or aliases, or asterisks. Use {@see self::selectAlias()} for that. * @psalm-this-out self + * @return $this * @since 34.0.0 + * @note Psalm has a bug that prevents inferring the correct type in chained calls: https://github.com/vimeo/psalm/issues/8803. Convert the chained calls to standalone calls or switch to PHPStan, which suffered the same bug in the past, but fixed it in 2.1.5: https://github.com/phpstan/phpstan/issues/8439 */ public function selectColumnsDistinct(string ...$columns): self; @@ -69,7 +73,8 @@ interface ITypedQueryBuilder extends IQueryBuilder { * @template NewS of string * @param NewS $alias * @psalm-this-out self - * @psalm-suppress LessSpecificImplementedReturnType + * @return $this + * @note Psalm has a bug that prevents inferring the correct type in chained calls: https://github.com/vimeo/psalm/issues/8803. Convert the chained calls to standalone calls or switch to PHPStan, which suffered the same bug in the past, but fixed it in 2.1.5: https://github.com/phpstan/phpstan/issues/8439 */ #[Override] public function selectAlias($select, $alias): self;