diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-01-27 00:57:52 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-01-27 01:30:48 +0100 |
commit | 6af2766d4f7bfe54ce0bbe1b70621d21e4c1f344 (patch) | |
tree | 921789021031e0dfe88225febc6a8ae884700f7f | |
parent | 1a8670e8b1049e257b53d539223f26791b3c3470 (diff) | |
download | nextcloud-server-chore/update-stub.tar.gz nextcloud-server-chore/update-stub.zip |
fix: Correctly type functionschore/update-stub
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/files_external/lib/Command/Notify.php | 6 | ||||
-rw-r--r-- | build/psalm-baseline.xml | 6 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 8 |
3 files changed, 7 insertions, 13 deletions
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index cd1889264b3..9f42d974ecf 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -168,7 +168,7 @@ class Notify extends StorageAuthBase { } private function getStorageIds(int $mountId, string $path): array { - $pathHash = md5(trim((string)\OC_Util::normalizeUnicode($path), '/')); + $pathHash = md5(trim(\OC_Util::normalizeUnicode($path), '/')); $qb = $this->connection->getQueryBuilder(); return $qb ->select('storage_id', 'user_id') @@ -176,12 +176,12 @@ class Notify extends StorageAuthBase { ->innerJoin('m', 'filecache', 'f', $qb->expr()->eq('m.storage_id', 'f.storage')) ->where($qb->expr()->eq('mount_id', $qb->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter($pathHash, IQueryBuilder::PARAM_STR))) - ->execute() + ->executeQuery() ->fetchAll(); } private function updateParent(array $storageIds, string $parent): int { - $pathHash = md5(trim((string)\OC_Util::normalizeUnicode($parent), '/')); + $pathHash = md5(trim(\OC_Util::normalizeUnicode($parent), '/')); $qb = $this->connection->getQueryBuilder(); return $qb ->update('filecache') diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 49ce3c7b054..011072a99e7 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -1766,7 +1766,6 @@ </InvalidNullableReturnType> <InvalidScalarArgument> <code><![CDATA[$path]]></code> - <code><![CDATA[\OC_Util::normalizeUnicode($path)]]></code> </InvalidScalarArgument> <NullableReturnStatement> <code><![CDATA[null]]></code> @@ -2026,11 +2025,6 @@ </NoInterfaceProperties> </file> <file src="lib/private/Files/Storage/Wrapper/Encoding.php"> - <InvalidArgument> - <code><![CDATA[\Normalizer::FORM_C]]></code> - <code><![CDATA[\Normalizer::FORM_C]]></code> - <code><![CDATA[\Normalizer::FORM_D]]></code> - </InvalidArgument> <UndefinedInterfaceMethod> <code><![CDATA[$this->namesCache]]></code> <code><![CDATA[$this->namesCache]]></code> diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index f82082d3d12..31d7df8960d 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -937,18 +937,18 @@ class OC_Util { } /** - * Normalize a unicode string + * Normalize a unicode string. * * @param string $value a not normalized string - * @return bool|string + * @return string The normalized string or the input if the normalization failed */ - public static function normalizeUnicode($value) { + public static function normalizeUnicode(string $value): string { if (Normalizer::isNormalized($value)) { return $value; } $normalizedValue = Normalizer::normalize($value); - if ($normalizedValue === null || $normalizedValue === false) { + if ($normalizedValue === false) { \OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); return $value; } |