Skip to content

Commit 6af2766

Browse files
committed
fix: Correctly type functions
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 1a8670e commit 6af2766

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

apps/files_external/lib/Command/Notify.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,20 @@ private function logUpdate(IChange $change, OutputInterface $output): void {
168168
}
169169

170170
private function getStorageIds(int $mountId, string $path): array {
171-
$pathHash = md5(trim((string)\OC_Util::normalizeUnicode($path), '/'));
171+
$pathHash = md5(trim(\OC_Util::normalizeUnicode($path), '/'));
172172
$qb = $this->connection->getQueryBuilder();
173173
return $qb
174174
->select('storage_id', 'user_id')
175175
->from('mounts', 'm')
176176
->innerJoin('m', 'filecache', 'f', $qb->expr()->eq('m.storage_id', 'f.storage'))
177177
->where($qb->expr()->eq('mount_id', $qb->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)))
178178
->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter($pathHash, IQueryBuilder::PARAM_STR)))
179-
->execute()
179+
->executeQuery()
180180
->fetchAll();
181181
}
182182

183183
private function updateParent(array $storageIds, string $parent): int {
184-
$pathHash = md5(trim((string)\OC_Util::normalizeUnicode($parent), '/'));
184+
$pathHash = md5(trim(\OC_Util::normalizeUnicode($parent), '/'));
185185
$qb = $this->connection->getQueryBuilder();
186186
return $qb
187187
->update('filecache')

build/psalm-baseline.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,6 @@
17661766
</InvalidNullableReturnType>
17671767
<InvalidScalarArgument>
17681768
<code><![CDATA[$path]]></code>
1769-
<code><![CDATA[\OC_Util::normalizeUnicode($path)]]></code>
17701769
</InvalidScalarArgument>
17711770
<NullableReturnStatement>
17721771
<code><![CDATA[null]]></code>
@@ -2026,11 +2025,6 @@
20262025
</NoInterfaceProperties>
20272026
</file>
20282027
<file src="lib/private/Files/Storage/Wrapper/Encoding.php">
2029-
<InvalidArgument>
2030-
<code><![CDATA[\Normalizer::FORM_C]]></code>
2031-
<code><![CDATA[\Normalizer::FORM_C]]></code>
2032-
<code><![CDATA[\Normalizer::FORM_D]]></code>
2033-
</InvalidArgument>
20342028
<UndefinedInterfaceMethod>
20352029
<code><![CDATA[$this->namesCache]]></code>
20362030
<code><![CDATA[$this->namesCache]]></code>

lib/private/legacy/OC_Util.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,18 @@ public static function getTheme() {
937937
}
938938

939939
/**
940-
* Normalize a unicode string
940+
* Normalize a unicode string.
941941
*
942942
* @param string $value a not normalized string
943-
* @return bool|string
943+
* @return string The normalized string or the input if the normalization failed
944944
*/
945-
public static function normalizeUnicode($value) {
945+
public static function normalizeUnicode(string $value): string {
946946
if (Normalizer::isNormalized($value)) {
947947
return $value;
948948
}
949949

950950
$normalizedValue = Normalizer::normalize($value);
951-
if ($normalizedValue === null || $normalizedValue === false) {
951+
if ($normalizedValue === false) {
952952
\OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "' . $value . '"', ['app' => 'core']);
953953
return $value;
954954
}

0 commit comments

Comments
 (0)