diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-18 13:22:50 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-10-18 13:22:50 +0200 |
commit | 419828c791f115fdef3bfa18b9f5c27b8057b292 (patch) | |
tree | 72c106650866da447d7af03fda3d335e42d0b2d3 | |
parent | bfd2b74c680836d5746d40023a7dc0f62216a6b7 (diff) | |
download | nextcloud-server-419828c791f115fdef3bfa18b9f5c27b8057b292.tar.gz nextcloud-server-419828c791f115fdef3bfa18b9f5c27b8057b292.zip |
Fix the type of the return array in a few more places
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r-- | build/psalm-baseline.xml | 13 | ||||
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php | 4 | ||||
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 4 |
3 files changed, 6 insertions, 15 deletions
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 9022134fbcf..0c86a532a11 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -2337,12 +2337,9 @@ </UndefinedMethod> </file> <file src="lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php"> - <InvalidReturnStatement occurrences="2"> - <code>$providers</code> - </InvalidReturnStatement> - <InvalidReturnType occurrences="2"> + <InvalidReturnStatement occurrences="1"/> + <InvalidReturnType occurrences="1"> <code>int[]</code> - <code>string[]</code> </InvalidReturnType> </file> <file src="lib/private/Authentication/TwoFactorAuth/Manager.php"> @@ -2350,12 +2347,6 @@ <code>IProvider::EVENT_FAILED</code> <code>IProvider::EVENT_SUCCESS</code> </InvalidArgument> - <InvalidReturnStatement occurrences="1"> - <code>$providerStates</code> - </InvalidReturnStatement> - <InvalidReturnType occurrences="1"> - <code>string[]</code> - </InvalidReturnType> <InvalidScalarArgument occurrences="2"> <code>$this->timeFactory->getTime()</code> <code>$tokenId</code> diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php index e9aa15e11b6..19d80218562 100644 --- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php +++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php @@ -47,7 +47,7 @@ class ProviderUserAssignmentDao { /** * Get all assigned provider IDs for the given user ID * - * @return string[] where the array key is the provider ID (string) and the + * @return array<string, bool> where the array key is the provider ID (string) and the * value is the enabled state (bool) */ public function getState(string $uid): array { @@ -59,7 +59,7 @@ class ProviderUserAssignmentDao { $result = $query->execute(); $providers = []; foreach ($result->fetchAll() as $row) { - $providers[$row['provider_id']] = 1 === (int)$row['enabled']; + $providers[(string)$row['provider_id']] = 1 === (int)$row['enabled']; } $result->closeCursor(); diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 66e7c090e42..37a9f03d073 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -170,10 +170,10 @@ class Manager { * * @todo remove in Nextcloud 17 as by then all providers should have been updated * - * @param string[] $providerStates + * @param array<string, bool> $providerStates * @param IProvider[] $providers * @param IUser $user - * @return string[] the updated $providerStates variable + * @return array<string, bool> the updated $providerStates variable */ private function fixMissingProviderStates(array $providerStates, array $providers, IUser $user): array { |