Skip to content

Commit 408f412

Browse files
committed
fix: Fix psalm issues
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 4ffe87c commit 408f412

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

lib/Db/FaceDetectionMapper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function find(int $id): FaceDetection {
4444
}
4545

4646
/**
47+
* @param FaceDetection $entity
4748
* @throws \OCP\DB\Exception
4849
*/
4950
public function insert(Entity $entity): FaceDetection {

lib/Service/FaceClusterAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ public static function calculateCentroidOfDetections(array $detections): array {
199199
}
200200

201201
foreach ($detections as $detection) {
202-
$sum = array_map(static function ($el, $el2) {
202+
$sum = array_map(static function (float $el, float $el2): float {
203203
return $el + $el2;
204204
}, $detection->getVector(), $sum);
205205
}
206206

207-
$centroid = array_map(static function ($el) use ($detections) {
207+
$centroid = array_map(static function (float $el) use ($detections): float {
208208
return $el / (float) count($detections);
209209
}, $sum);
210210

psalm-baseline.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.10.0@9c0add4eb88d4b169ac04acb7c679918cbb9c252">
2+
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51">
33
<file src="lib/AppInfo/Application.php">
44
<DeprecatedInterface>
55
<code><![CDATA[$this->getContainer()]]></code>
@@ -776,18 +776,21 @@
776776
<file src="lib/Db/FaceDetection.php">
777777
<MissingPropertyType>
778778
<code><![CDATA[$clusterId]]></code>
779+
<code><![CDATA[$faceVector]]></code>
779780
<code><![CDATA[$fileId]]></code>
780781
<code><![CDATA[$height]]></code>
781782
<code><![CDATA[$threshold]]></code>
782783
<code><![CDATA[$userId]]></code>
783-
<code><![CDATA[$vector]]></code>
784784
<code><![CDATA[$width]]></code>
785785
<code><![CDATA[$x]]></code>
786786
<code><![CDATA[$y]]></code>
787787
</MissingPropertyType>
788788
<MixedAssignment>
789789
<code><![CDATA[$array[$field]]]></code>
790790
</MixedAssignment>
791+
<MixedReturnStatement>
792+
<code><![CDATA[$this->getter('faceVector')]]></code>
793+
</MixedReturnStatement>
791794
<PropertyNotSetInConstructor>
792795
<code><![CDATA[FaceDetection]]></code>
793796
</PropertyNotSetInConstructor>
@@ -798,6 +801,7 @@
798801
<code><![CDATA[final class FaceDetectionMapper extends QBMapper {]]></code>
799802
</InvalidDocblock>
800803
<LessSpecificReturnStatement>
804+
<code><![CDATA[$duplicates[0]]]></code>
801805
<code><![CDATA[$this->findEntities($qb)]]></code>
802806
<code><![CDATA[$this->findEntities($qb)]]></code>
803807
<code><![CDATA[$this->findEntities($qb)]]></code>
@@ -810,11 +814,18 @@
810814
<code><![CDATA[$this->findEntity($qb)]]></code>
811815
<code><![CDATA[$this->findEntity($qb)]]></code>
812816
<code><![CDATA[$this->findEntity($qb)]]></code>
817+
<code><![CDATA[parent::insert($entity)]]></code>
818+
<code><![CDATA[parent::insert($entity)]]></code>
813819
</LessSpecificReturnStatement>
814820
<MissingTemplateParam>
815821
<code><![CDATA[FaceDetectionMapper]]></code>
816822
</MissingTemplateParam>
823+
<MoreSpecificImplementedParamType>
824+
<code><![CDATA[$entity]]></code>
825+
</MoreSpecificImplementedParamType>
817826
<MoreSpecificReturnType>
827+
<code><![CDATA[FaceDetection]]></code>
828+
<code><![CDATA[FaceDetection]]></code>
818829
<code><![CDATA[FaceDetection]]></code>
819830
<code><![CDATA[FaceDetection]]></code>
820831
<code><![CDATA[FaceDetection[]]]></code>
@@ -993,6 +1004,14 @@
9931004
<code><![CDATA[$returnCode]]></code>
9941005
</PossiblyUndefinedVariable>
9951006
</file>
1007+
<file src="lib/Migration/Version010000001Date20250727094721.php">
1008+
<MissingReturnType>
1009+
<code><![CDATA[postSchemaChange]]></code>
1010+
</MissingReturnType>
1011+
<MixedArgument>
1012+
<code><![CDATA[IQueryBuilder::PARAM_INT_ARRAY]]></code>
1013+
</MixedArgument>
1014+
</file>
9961015
<file src="lib/Service/DownloadModelsService.php">
9971016
<MixedArgument>
9981017
<code><![CDATA[$file->getRealPath()]]></code>

0 commit comments

Comments
 (0)