Skip to content

Commit 8d41378

Browse files
author
Carl Schwan
committed
chore: Add Sabre types to psalm
So that psalm can detects issues with the DAV related code. Signed-off-by: Carl Schwan <[email protected]>
1 parent 9270928 commit 8d41378

40 files changed

+8747
-422
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
}
1515
},
1616
"require-dev": {
17-
"nextcloud/ocp": "dev-master",
1817
"symfony/console": "^6.4",
1918
"symfony/process": "^6.4"
2019
},

lib/AppInfo/Application.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
use OCP\Files\Events\Node\NodeDeletedEvent;
2424
use OCP\Files\Events\Node\NodeRenamedEvent;
2525
use OCP\Files\Events\NodeRemovedFromCache;
26-
use OCP\SabrePluginEvent;
27-
use OCP\Share\Events\ShareCreatedEvent;
28-
use OCP\Share\Events\ShareDeletedEvent;
2926

3027
final class Application extends App implements IBootstrap {
3128
public const APP_ID = 'recognize';

lib/BackgroundJobs/ClassifierJob.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
declare(strict_types=1);
88
namespace OCA\Recognize\BackgroundJobs;
99

10+
use OCA\Recognize\Db\QueueFile;
1011
use OCA\Recognize\Service\QueueService;
1112
use OCA\Recognize\Service\SettingsService;
1213
use OCP\AppFramework\Utility\ITimeFactory;
@@ -33,16 +34,16 @@ public function __construct(
3334
$this->setAllowParallelRuns($settingsService->getSetting('concurrency.enabled') === 'true');
3435
}
3536

37+
/**
38+
* @param array{storageId: int, rootId: int} $argument
39+
*/
3640
protected function runClassifier(string $model, array $argument): void {
3741
sleep(10);
3842
if ($this->settingsService->getSetting('concurrency.enabled') !== 'true' && $this->anyOtherClassifierJobsRunning()) {
3943
$this->logger->debug('Stalling job '.static::class.' with argument ' . var_export($argument, true) . ' because other classifiers are already reserved');
4044
return;
4145
}
4246

43-
/**
44-
* @var int $storageId
45-
*/
4647
$storageId = $argument['storageId'];
4748
$rootId = $argument['rootId'];
4849
if ($this->settingsService->getSetting($model.'.enabled') !== 'true') {
@@ -100,22 +101,15 @@ protected function runClassifier(string $model, array $argument): void {
100101
}
101102
}
102103

103-
/**
104-
* @return int
105-
*/
106104
abstract protected function getBatchSize(): int;
107105

108106
/**
109-
* @param list<OCA\Recognize\Db\QueueFile> $files
110-
* @return void
107+
* @param list<QueueFile> $files
111108
* @throws \RuntimeException|\ErrorException
112109
*/
113110
abstract protected function classify(array $files) : void;
114111

115-
/**
116-
* @return bool
117-
*/
118-
private function anyOtherClassifierJobsRunning() {
112+
private function anyOtherClassifierJobsRunning(): bool {
119113
foreach ([
120114
ClassifyFacesJob::class,
121115
ClassifyImagenetJob::class,

lib/BackgroundJobs/ClassifyFacesJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(ITimeFactory $time, Logger $logger, QueueService $qu
2828
}
2929

3030
/**
31-
* @inheritDoc
31+
* @param array{storageId: int, rootId: int} $argument
3232
*/
3333
protected function run($argument): void {
3434
$this->runClassifier(self::MODEL_NAME, $argument);

lib/BackgroundJobs/ClassifyImagenetJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(ITimeFactory $time, Logger $logger, QueueService $qu
2828
}
2929

3030
/**
31-
* @inheritDoc
31+
* @param array{storageId: int, rootId: int} $argument
3232
*/
3333
protected function run($argument): void {
3434
$this->runClassifier(self::MODEL_NAME, $argument);

lib/BackgroundJobs/ClassifyLandmarksJob.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace OCA\Recognize\BackgroundJobs;
99

1010
use OCA\Recognize\Classifiers\Images\LandmarksClassifier;
11+
use OCA\Recognize\Db\QueueFile;
1112
use OCA\Recognize\Service\Logger;
1213
use OCA\Recognize\Service\QueueService;
1314
use OCA\Recognize\Service\SettingsService;
@@ -28,14 +29,14 @@ public function __construct(ITimeFactory $time, Logger $logger, QueueService $qu
2829
}
2930

3031
/**
31-
* @inheritDoc
32+
* @param array{storageId: int, rootId: int} $argument
3233
*/
3334
protected function run($argument): void {
3435
$this->runClassifier(self::MODEL_NAME, $argument);
3536
}
3637

3738
/**
38-
* @param list<\OCA\Recognize\Db\QueueFile> $files
39+
* @param list<QueueFile> $files
3940
* @return void
4041
*/
4142
protected function classify(array $files) : void {

lib/BackgroundJobs/ClassifyMovinetJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public function __construct(ITimeFactory $time, Logger $logger, QueueService $qu
2828
}
2929

3030
/**
31-
* @inheritDoc
31+
* @param array{storageId: int, rootId: int} $argument
3232
*/
33-
protected function run($argument):void {
33+
protected function run($argument): void {
3434
$this->runClassifier(self::MODEL_NAME, $argument);
3535
}
3636

lib/BackgroundJobs/ClassifyMusicnnJob.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ public function __construct(ITimeFactory $time, Logger $logger, QueueService $qu
2828
}
2929

3030
/**
31-
* @inheritDoc
32-
*
33-
* @return void
31+
* @param array{storageId: int, rootId: int} $argument
3432
*/
35-
protected function run($argument) {
33+
protected function run($argument): void {
3634
$this->runClassifier(self::MODEL_NAME, $argument);
3735
}
3836

lib/BackgroundJobs/ClusterFacesJob.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ public function __construct(ITimeFactory $time, Logger $logger, IJobList $jobLis
3131
}
3232

3333
/**
34-
* @inheritDoc
35-
*
36-
* @return void
34+
* @param array{storageId: int, rootId: int, userId: string} $argument
3735
*/
38-
protected function run($argument) {
39-
$userId = (string) $argument['userId'];
36+
protected function run($argument): void {
37+
$userId = $argument['userId'];
4038
try {
4139
$this->clusterAnalyzer->calculateClusters($userId, self::BATCH_SIZE);
4240
} catch (\Throwable $e) {

lib/BackgroundJobs/MaintenanceJob.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ public function __construct(
2828
}
2929

3030
/**
31-
* @param mixed $argument
32-
* @return void
31+
* @param array{storageId: int, rootId: int} $argument
3332
*/
34-
protected function run($argument) {
33+
protected function run($argument): void {
3534
// Trigger clustering in case it's stuck
3635
try {
3736
$users = $this->faceDetectionMapper->getUsersForUnclustered();

0 commit comments

Comments
 (0)