Skip to content

Conversation

@CarlSchwan
Copy link
Member

  • Resolves: #

Summary

TODO

  • ...

Checklist

@CarlSchwan CarlSchwan added this to the Nextcloud 34 milestone Jan 23, 2026
@CarlSchwan CarlSchwan self-assigned this Jan 23, 2026
@CarlSchwan CarlSchwan added 2. developing Work in progress feature: database Database related DB labels Jan 23, 2026
@CarlSchwan CarlSchwan force-pushed the carl/type-querybuilder branch 7 times, most recently from 4949aa8 to 27c24e9 Compare January 26, 2026 10:02
@CarlSchwan CarlSchwan force-pushed the carl/type-querybuilder branch from 27c24e9 to 75af4a1 Compare January 26, 2026 13:51
And make sure the related unit tests are also typed and checked by
psalm.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan force-pushed the carl/type-querybuilder branch from 75af4a1 to ca05129 Compare January 27, 2026 10:17
@CarlSchwan CarlSchwan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 27, 2026
@CarlSchwan CarlSchwan marked this pull request as ready for review January 27, 2026 10:18
@CarlSchwan CarlSchwan requested review from Altahrim, ArtificialOwl, icewind1991 and sorbaugh and removed request for a team January 27, 2026 10:18
*/
public function eq($x, $y, $type = null): string {
#[Override]
public function eq(string|ILiteral|IQueryFunction|IParameter $x, IQueryFunction|ILiteral|IParameter|string $y, int|string|null $type = null): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function eq(string|ILiteral|IQueryFunction|IParameter $x, IQueryFunction|ILiteral|IParameter|string $y, int|string|null $type = null): string {
public function eq(
string|ILiteral|IQueryFunction|IParameter $x,
IQueryFunction|ILiteral|IParameter|string $y,
int|string|null $type = null,
): string {

Please split on several lines when types get that complicated.

*/
public function like($x, $y, $type = null): string {
#[Override]
public function like(ILiteral|IParameter|IQueryFunction|string $x, mixed $y, mixed $type = null): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these parameters mixed and not the same as the other methods above?

* @return string
*/
public function notIn($x, $y, $type = null): string {
#[Override]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the types parameter in the file should be typed the same way.

Comment on lines +258 to +259
parent::innerJoin($fromAlias, $join, $alias, $condition);
return $this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you properly type the methods with @return $this in phpdoc you do not need to split all these return parent::… into 2 lines, as $this of self and parent is the same.

* @since 12.0.0
*/
public function concat($x, ...$expr): IQueryFunction;
public function concat(string|ILiteral|IParameter|IQueryFunction $x, ...$expr): IQueryFunction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can type the variadic parameter as well.

* Gets the type of the currently built query.
*
* @return integer
* @deprecated Since 34.0.0, if necessary, track the type of the query being built outside of the builder.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated Since 34.0.0, if necessary, track the type of the query being built outside of the builder.
* @deprecated 34.0.0 If necessary, track the type of the query being built outside of the builder.

* @param mixed $value The parameter value.
* @param string|null|int $type One of the IQueryBuilder::PARAM_* constants.
*
* @return $this This QueryBuilder instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have the @return $this on all fluent methods. It’s stronger typing than : self.

* @param mixed $key The key (index or name) of the bound parameter type.
* @param int|string $key The key (index or name) of the bound parameter type.
*
* @return mixed The value of the bound parameter type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it’s the type and not the value?
And probably string|int and not mixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews feature: database Database related DB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants