Skip to content

Commit

Permalink
fix psalm
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed May 29, 2024
1 parent 199f14e commit c867b25
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer run text:unit
run: composer run test:unit
4 changes: 2 additions & 2 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
ocp-version: [ '^28', 'dev-master' ]
ocp-version: [ 'dev-master' ]
php-version: [ '8.0', '8.1', '8.2', '8.3' ]


Expand All @@ -63,7 +63,7 @@ jobs:
run: composer require --dev nextcloud/ocp:${{ matrix.ocp-version }} --ignore-platform-reqs --with-dependencies

- name: Install dependencies
run: composer require --dev
run: composer require --dev

- name: Run coding standards check
run: composer run psalm
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"cs:fix": "php-cs-fixer fix",
"test:unit": "phpunit --config tests/phpunit.xml",
"psalm": "psalm.phar --no-cache",
"psalm:update-baseline": "psalm.phar --threads=1 --update-baseline",
"psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"post-install-cmd": [
"@composer bin all install --ansi",
"composer dump-autoload"
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions lib/TaskProcessing/HeadlineProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use OCP\TaskProcessing\TaskTypes\TextToTextHeadline;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class HeadlineProvider implements ISynchronousProvider {

public function __construct(
Expand Down
3 changes: 0 additions & 3 deletions lib/TaskProcessing/STTProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
use Psr\Log\LoggerInterface;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class STTProvider implements ISynchronousProvider {

public function __construct(
Expand Down
3 changes: 0 additions & 3 deletions lib/TaskProcessing/SummaryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use OCP\TaskProcessing\TaskTypes\TextToTextSummary;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class SummaryProvider implements ISynchronousProvider {

public function __construct(
Expand Down
4 changes: 1 addition & 3 deletions lib/TaskProcessing/TextToImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
use Psr\Log\LoggerInterface;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class TextToImageProvider implements ISynchronousProvider {

public function __construct(
Expand Down Expand Up @@ -95,6 +92,7 @@ public function process(?string $userId, array $input, callable $reportProgress)
}
$endTime = time();
$this->openAiAPIService->updateExpImgProcessingTime($endTime - $startTime);
/** @var array<string, list<numeric|string>|numeric|string> $output */
return $output;
} catch(\Exception $e) {
$this->logger->warning('OpenAI/LocalAI\'s text to image generation failed with: ' . $e->getMessage(), ['exception' => $e]);
Expand Down
3 changes: 0 additions & 3 deletions lib/TaskProcessing/TextToTextProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use OCP\TaskProcessing\TaskTypes\TextToText;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class TextToTextProvider implements ISynchronousProvider {

public function __construct(
Expand Down
3 changes: 0 additions & 3 deletions lib/TaskProcessing/TopicsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use OCP\TaskProcessing\TaskTypes\TextToTextTopics;
use RuntimeException;

/**
* @template-implements ISynchronousProvider
*/
class TopicsProvider implements ISynchronousProvider {

public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<psalm
errorBaseline="tests/psalm-baseline.xml"
errorLevel="4"
findUnusedBaselineEntry="true"
findUnusedCode="false"
Expand Down Expand Up @@ -29,6 +30,8 @@
<referencedClass name="Symfony\Component\Console\Command\Command" />
<referencedClass name="GuzzleHttp\Exception\ServerException" />
<referencedClass name="GuzzleHttp\Exception\ClientException" />
<referencedClass name="OCP\TaskProcessing\ISynchronousProvider" />
<referencedClass name="OCP\TaskProcessing\EShapeType" />
</errorLevel>
</UndefinedClass>
<UndefinedDocblockClass>
Expand Down
3 changes: 3 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48">
</files>
12 changes: 6 additions & 6 deletions vendor-bin/php-cs-fixer/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 13 additions & 14 deletions vendor-bin/phpunit/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions vendor-bin/psalm-phar/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c867b25

Please sign in to comment.