Skip to content

Commit e801057

Browse files
committed
fix(database): properly pass through generics to query builder traits
1 parent 99d5cac commit e801057

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

packages/database/src/Builder/QueryBuilders/CountQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @template TModel of object
2020
* @implements \Tempest\Database\Builder\QueryBuilders\BuildsQuery<TModel>
21-
* @uses \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
21+
* @use \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
2222
*/
2323
final class CountQueryBuilder implements BuildsQuery
2424
{

packages/database/src/Builder/QueryBuilders/DeleteQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* @template TModel of object
1717
* @implements \Tempest\Database\Builder\QueryBuilders\BuildsQuery<TModel>
18-
* @uses \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
18+
* @use \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
1919
*/
2020
final class DeleteQueryBuilder implements BuildsQuery
2121
{

packages/database/src/Builder/QueryBuilders/HasConvenientWhereMethods.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function buildCondition(string $fieldDefinition, WhereOperator $operat
102102
*
103103
* @param class-string<UnitEnum>|UnitEnum|array<UnitEnum|mixed> $values
104104
*
105-
* @return static<TModel>
105+
* @return self<TModel>
106106
*/
107107
public function whereIn(string $field, string|UnitEnum|array|ArrayAccess $values): self
108108
{
@@ -114,7 +114,7 @@ public function whereIn(string $field, string|UnitEnum|array|ArrayAccess $values
114114
*
115115
* @param class-string<UnitEnum>|UnitEnum|array<UnitEnum|mixed> $values
116116
*
117-
* @return static<TModel>
117+
* @return self<TModel>
118118
*/
119119
public function whereNotIn(string $field, string|UnitEnum|array|ArrayAccess $values): self
120120
{
@@ -124,7 +124,7 @@ public function whereNotIn(string $field, string|UnitEnum|array|ArrayAccess $val
124124
/**
125125
* Adds a `WHERE BETWEEN` condition.
126126
*
127-
* @return static<TModel>
127+
* @return self<TModel>
128128
*/
129129
public function whereBetween(string $field, DateTimeInterface|string|float|int|Countable $min, DateTimeInterface|string|float|int|Countable $max): self
130130
{
@@ -134,7 +134,7 @@ public function whereBetween(string $field, DateTimeInterface|string|float|int|C
134134
/**
135135
* Adds a `WHERE NOT BETWEEN` condition.
136136
*
137-
* @return static<TModel>
137+
* @return self<TModel>
138138
*/
139139
public function whereNotBetween(string $field, DateTimeInterface|string|float|int|Countable $min, DateTimeInterface|string|float|int|Countable $max): self
140140
{
@@ -144,7 +144,7 @@ public function whereNotBetween(string $field, DateTimeInterface|string|float|in
144144
/**
145145
* Adds a `WHERE IS NULL` condition.
146146
*
147-
* @return static<TModel>
147+
* @return self<TModel>
148148
*/
149149
public function whereNull(string $field): self
150150
{
@@ -154,7 +154,7 @@ public function whereNull(string $field): self
154154
/**
155155
* Adds a `WHERE IS NOT NULL` condition.
156156
*
157-
* @return static<TModel>
157+
* @return self<TModel>
158158
*/
159159
public function whereNotNull(string $field): self
160160
{
@@ -164,7 +164,7 @@ public function whereNotNull(string $field): self
164164
/**
165165
* Adds a `WHERE NOT` condition (shorthand for != operator).
166166
*
167-
* @return static<TModel>
167+
* @return self<TModel>
168168
*/
169169
public function whereNot(string $field, mixed $value): self
170170
{
@@ -174,7 +174,7 @@ public function whereNot(string $field, mixed $value): self
174174
/**
175175
* Adds a `WHERE LIKE` condition.
176176
*
177-
* @return static<TModel>
177+
* @return self<TModel>
178178
*/
179179
public function whereLike(string $field, string $value): self
180180
{
@@ -184,7 +184,7 @@ public function whereLike(string $field, string $value): self
184184
/**
185185
* Adds a `WHERE NOT LIKE` condition.
186186
*
187-
* @return static<TModel>
187+
* @return self<TModel>
188188
*/
189189
public function whereNotLike(string $field, string $value): self
190190
{
@@ -196,7 +196,7 @@ public function whereNotLike(string $field, string $value): self
196196
*
197197
* @param class-string<UnitEnum>|UnitEnum|array<UnitEnum|mixed> $values
198198
*
199-
* @return static<TModel>
199+
* @return self<TModel>
200200
*/
201201
public function orWhereIn(string $field, string|UnitEnum|array|ArrayAccess $values): self
202202
{
@@ -208,7 +208,7 @@ public function orWhereIn(string $field, string|UnitEnum|array|ArrayAccess $valu
208208
*
209209
* @param class-string<UnitEnum>|UnitEnum|array<UnitEnum|mixed> $values
210210
*
211-
* @return static<TModel>
211+
* @return self<TModel>
212212
*/
213213
public function orWhereNotIn(string $field, string|UnitEnum|array|ArrayAccess $values): self
214214
{
@@ -218,7 +218,7 @@ public function orWhereNotIn(string $field, string|UnitEnum|array|ArrayAccess $v
218218
/**
219219
* Adds an `OR WHERE BETWEEN` condition.
220220
*
221-
* @return static<TModel>
221+
* @return self<TModel>
222222
*/
223223
public function orWhereBetween(string $field, DateTimeInterface|string|float|int|Countable $min, DateTimeInterface|string|float|int|Countable $max): self
224224
{
@@ -228,7 +228,7 @@ public function orWhereBetween(string $field, DateTimeInterface|string|float|int
228228
/**
229229
* Adds an `OR WHERE NOT BETWEEN` condition.
230230
*
231-
* @return static<TModel>
231+
* @return self<TModel>
232232
*/
233233
public function orWhereNotBetween(string $field, DateTimeInterface|string|float|int|Countable $min, DateTimeInterface|string|float|int|Countable $max): self
234234
{
@@ -238,7 +238,7 @@ public function orWhereNotBetween(string $field, DateTimeInterface|string|float|
238238
/**
239239
* Adds an `OR WHERE IS NULL` condition.
240240
*
241-
* @return static<TModel>
241+
* @return self<TModel>
242242
*/
243243
public function orWhereNull(string $field): self
244244
{
@@ -248,7 +248,7 @@ public function orWhereNull(string $field): self
248248
/**
249249
* Adds an `OR WHERE IS NOT NULL` condition.
250250
*
251-
* @return static<TModel>
251+
* @return self<TModel>
252252
*/
253253
public function orWhereNotNull(string $field): self
254254
{
@@ -258,7 +258,7 @@ public function orWhereNotNull(string $field): self
258258
/**
259259
* Adds an `OR WHERE NOT` condition (shorthand for != operator).
260260
*
261-
* @return static<TModel>
261+
* @return self<TModel>
262262
*/
263263
public function orWhereNot(string $field, mixed $value): self
264264
{
@@ -268,7 +268,7 @@ public function orWhereNot(string $field, mixed $value): self
268268
/**
269269
* Adds an `OR WHERE LIKE` condition.
270270
*
271-
* @return static<TModel>
271+
* @return self<TModel>
272272
*/
273273
public function orWhereLike(string $field, string $value): self
274274
{
@@ -278,7 +278,7 @@ public function orWhereLike(string $field, string $value): self
278278
/**
279279
* Adds an `OR WHERE NOT LIKE` condition.
280280
*
281-
* @return static<TModel>
281+
* @return self<TModel>
282282
*/
283283
public function orWhereNotLike(string $field, string $value): self
284284
{
@@ -288,7 +288,7 @@ public function orWhereNotLike(string $field, string $value): self
288288
/**
289289
* Adds a `WHERE` condition for records from today.
290290
*
291-
* @return static<TModel>
291+
* @return self<TModel>
292292
*/
293293
public function whereToday(string $field): self
294294
{
@@ -300,7 +300,7 @@ public function whereToday(string $field): self
300300
/**
301301
* Adds a `WHERE` condition for records from yesterday.
302302
*
303-
* @return static<TModel>
303+
* @return self<TModel>
304304
*/
305305
public function whereYesterday(string $field): self
306306
{
@@ -312,7 +312,7 @@ public function whereYesterday(string $field): self
312312
/**
313313
* Adds a `WHERE` condition for records from this week.
314314
*
315-
* @return static<TModel>
315+
* @return self<TModel>
316316
*/
317317
public function whereThisWeek(string $field): self
318318
{
@@ -324,7 +324,7 @@ public function whereThisWeek(string $field): self
324324
/**
325325
* Adds a `WHERE` condition for records from last week.
326326
*
327-
* @return static<TModel>
327+
* @return self<TModel>
328328
*/
329329
public function whereLastWeek(string $field): self
330330
{
@@ -336,7 +336,7 @@ public function whereLastWeek(string $field): self
336336
/**
337337
* Adds a `WHERE` condition for records from this month.
338338
*
339-
* @return static<TModel>
339+
* @return self<TModel>
340340
*/
341341
public function whereThisMonth(string $field): self
342342
{
@@ -348,7 +348,7 @@ public function whereThisMonth(string $field): self
348348
/**
349349
* Adds a `WHERE` condition for records from last month.
350350
*
351-
* @return static<TModel>
351+
* @return self<TModel>
352352
*/
353353
public function whereLastMonth(string $field): self
354354
{
@@ -360,7 +360,7 @@ public function whereLastMonth(string $field): self
360360
/**
361361
* Adds a `WHERE` condition for records from this year.
362362
*
363-
* @return static<TModel>
363+
* @return self<TModel>
364364
*/
365365
public function whereThisYear(string $field): self
366366
{
@@ -372,7 +372,7 @@ public function whereThisYear(string $field): self
372372
/**
373373
* Adds a `WHERE` condition for records from last year.
374374
*
375-
* @return static<TModel>
375+
* @return self<TModel>
376376
*/
377377
public function whereLastYear(string $field): self
378378
{
@@ -384,7 +384,7 @@ public function whereLastYear(string $field): self
384384
/**
385385
* Adds a `WHERE` condition for records created after a specific date.
386386
*
387-
* @return static<TModel>
387+
* @return self<TModel>
388388
*/
389389
public function whereAfter(string $field, DateTimeInterface|string $date): self
390390
{
@@ -394,7 +394,7 @@ public function whereAfter(string $field, DateTimeInterface|string $date): self
394394
/**
395395
* Adds a `WHERE` condition for records created before a specific date.
396396
*
397-
* @return static<TModel>
397+
* @return self<TModel>
398398
*/
399399
public function whereBefore(string $field, DateTimeInterface|string $date): self
400400
{
@@ -404,7 +404,7 @@ public function whereBefore(string $field, DateTimeInterface|string $date): self
404404
/**
405405
* Adds an `OR WHERE` condition for records from today.
406406
*
407-
* @return static<TModel>
407+
* @return self<TModel>
408408
*/
409409
public function orWhereToday(string $field): self
410410
{
@@ -415,7 +415,7 @@ public function orWhereToday(string $field): self
415415
/**
416416
* Adds an `OR WHERE` condition for records from yesterday.
417417
*
418-
* @return static<TModel>
418+
* @return self<TModel>
419419
*/
420420
public function orWhereYesterday(string $field): self
421421
{
@@ -427,7 +427,7 @@ public function orWhereYesterday(string $field): self
427427
/**
428428
* Adds an `OR WHERE` condition for records from this week.
429429
*
430-
* @return static<TModel>
430+
* @return self<TModel>
431431
*/
432432
public function orWhereThisWeek(string $field): self
433433
{
@@ -439,7 +439,7 @@ public function orWhereThisWeek(string $field): self
439439
/**
440440
* Adds an `OR WHERE` condition for records from this month.
441441
*
442-
* @return static<TModel>
442+
* @return self<TModel>
443443
*/
444444
public function orWhereThisMonth(string $field): self
445445
{
@@ -451,7 +451,7 @@ public function orWhereThisMonth(string $field): self
451451
/**
452452
* Adds an `OR WHERE` condition for records from this year.
453453
*
454-
* @return static<TModel>
454+
* @return self<TModel>
455455
*/
456456
public function orWhereThisYear(string $field): self
457457
{
@@ -463,7 +463,7 @@ public function orWhereThisYear(string $field): self
463463
/**
464464
* Adds an `OR WHERE` condition for records created after a specific date.
465465
*
466-
* @return static<TModel>
466+
* @return self<TModel>
467467
*/
468468
public function orWhereAfter(string $field, DateTimeInterface|string $date): self
469469
{
@@ -473,7 +473,7 @@ public function orWhereAfter(string $field, DateTimeInterface|string $date): sel
473473
/**
474474
* Adds an `OR WHERE` condition for records created before a specific date.
475475
*
476-
* @return static<TModel>
476+
* @return self<TModel>
477477
*/
478478
public function orWhereBefore(string $field, DateTimeInterface|string $date): self
479479
{
@@ -484,15 +484,15 @@ public function orWhereBefore(string $field, DateTimeInterface|string $date): se
484484
* Abstract method that must be implemented by classes using this trait.
485485
* Should add a basic WHERE condition.
486486
*
487-
* @return static<TModel>
487+
* @return self<TModel>
488488
*/
489489
abstract public function where(string $field, mixed $value, string|WhereOperator $operator = WhereOperator::EQUALS): self;
490490

491491
/**
492492
* Abstract method that must be implemented by classes using this trait.
493493
* Should add an OR WHERE condition.
494494
*
495-
* @return static<TModel>
495+
* @return self<TModel>
496496
*/
497497
abstract public function orWhere(string $field, mixed $value, WhereOperator $operator = WhereOperator::EQUALS): self;
498498
}

packages/database/src/Builder/QueryBuilders/HasWhereQueryBuilderMethods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* @template TModel of object
1515
* @phpstan-require-implements \Tempest\Database\Builder\QueryBuilders\BuildsQuery
16-
* @uses \Tempest\Database\Builder\QueryBuilders\HasConvenientWhereMethods<TModel>
16+
* @use \Tempest\Database\Builder\QueryBuilders\HasConvenientWhereMethods<TModel>
1717
*/
1818
trait HasWhereQueryBuilderMethods
1919
{

packages/database/src/Builder/QueryBuilders/SelectQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* @template TModel of object
3434
* @implements \Tempest\Database\Builder\QueryBuilders\BuildsQuery<TModel>
35-
* @uses \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
35+
* @use \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
3636
*/
3737
final class SelectQueryBuilder implements BuildsQuery
3838
{

packages/database/src/Builder/QueryBuilders/UpdateQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* @template TModel of object
2929
* @implements \Tempest\Database\Builder\QueryBuilders\BuildsQuery<TModel>
30-
* @uses \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
30+
* @use \Tempest\Database\Builder\QueryBuilders\HasWhereQueryBuilderMethods<TModel>
3131
*/
3232
final class UpdateQueryBuilder implements BuildsQuery
3333
{

0 commit comments

Comments
 (0)