mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Annotate JWT user lookups as User for static analysis
getDocument() is declared as returning Document, so the sessionActive() calls in the JWT auth paths tripped PHPStan's method.notFound. The users collection is mapped to User via setDocumentType(), matching the annotations already on the cookie-path lookups above.
This commit is contained in:
1 parent
695f0ad4b5
commit
ab5dbebbc0
2 files changed
+4
No files matched your search
@@ -288,8 +288,10 @@ return function (Container $container): void {
|
||||
$jwtUserId = $payload['userId'] ?? '';
|
||||
if (!empty($jwtUserId)) {
|
||||
if ($mode === APP_MODE_ADMIN) {
|
||||
/** @var User $user */
|
||||
$user = $dbForPlatform->getDocument('users', $jwtUserId);
|
||||
} else {
|
||||
/** @var User $user */
|
||||
$user = $dbForProject->getDocument('users', $jwtUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,8 +536,10 @@ return function (Container $context): void {
|
||||
$jwtUserId = $payload['userId'] ?? '';
|
||||
if (! empty($jwtUserId)) {
|
||||
if ($mode === APP_MODE_ADMIN) {
|
||||
/** @var User $user */
|
||||
$user = $dbForPlatform->getDocument('users', $jwtUserId);
|
||||
} else {
|
||||
/** @var User $user */
|
||||
$user = $dbForProject->getDocument('users', $jwtUserId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user