Skip to content

Commit b0a1faf

Browse files
abnegateclaude
andcommitted
fix: use static return types and remove PHPStan stubs
Update Query overrides to use `: static` return types matching the base query package. Remove the phpstan.neon and stubs workaround since the query package now uses `: static` natively. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d942f2b commit b0a1faf

3 files changed

Lines changed: 7 additions & 332 deletions

File tree

phpstan.neon

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/Database/Query.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Utopia\Query\Exception as BaseQueryException;
77
use Utopia\Query\Query as BaseQuery;
88

9+
/** @phpstan-consistent-constructor */
910
class Query extends BaseQuery
1011
{
1112
protected bool $isObjectAttribute = false;
@@ -23,11 +24,9 @@ public function __construct(string $method, string $attribute = '', array $value
2324
}
2425

2526
/**
26-
* @param string $query
27-
* @return self
2827
* @throws QueryException
2928
*/
30-
public static function parse(string $query): self
29+
public static function parse(string $query): static
3130
{
3231
try {
3332
return parent::parse($query);
@@ -38,10 +37,9 @@ public static function parse(string $query): self
3837

3938
/**
4039
* @param array<string, mixed> $query
41-
* @return self
4240
* @throws QueryException
4341
*/
44-
public static function parseQuery(array $query): self
42+
public static function parseQuery(array $query): static
4543
{
4644
try {
4745
return parent::parseQuery($query);
@@ -51,25 +49,19 @@ public static function parseQuery(array $query): self
5149
}
5250

5351
/**
54-
* Helper method to create Query with cursorAfter method
55-
*
5652
* @param Document $value
57-
* @return Query
5853
*/
59-
public static function cursorAfter(mixed $value): self
54+
public static function cursorAfter(mixed $value): static
6055
{
61-
return new self(self::TYPE_CURSOR_AFTER, values: [$value]);
56+
return new static(self::TYPE_CURSOR_AFTER, values: [$value]);
6257
}
6358

6459
/**
65-
* Helper method to create Query with cursorBefore method
66-
*
6760
* @param Document $value
68-
* @return Query
6961
*/
70-
public static function cursorBefore(mixed $value): self
62+
public static function cursorBefore(mixed $value): static
7163
{
72-
return new self(self::TYPE_CURSOR_BEFORE, values: [$value]);
64+
return new static(self::TYPE_CURSOR_BEFORE, values: [$value]);
7365
}
7466

7567
/**

stubs/Query.stub

Lines changed: 0 additions & 314 deletions
This file was deleted.

0 commit comments

Comments
 (0)