Skip to content

Commit

Permalink
Fixed some psalm errors (and some are ignored as Client is bunny stuff)
Browse files Browse the repository at this point in the history
  • Loading branch information
bckp committed Feb 12, 2024
1 parent 00901ff commit df670a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<psalm
errorLevel="2"
resolveFromConfigFile="true"
findUnusedBaselineEntry="false"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -10,6 +12,7 @@
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
<file name="src/Connection/Client.php" />
</ignoreFiles>
</projectFiles>
</psalm>
6 changes: 3 additions & 3 deletions src/Connection/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public function createFederation(
'exchange' => $name,
];

if ($messageTTL) {
if ($messageTTL !== null && $messageTTL > 0) {
$federationParamsPrototype['message-ttl'] = $messageTTL;
}
if ($expires) {
if ($expires !== null && $expires > 0) {
$federationParamsPrototype['expires'] = $expires;
}

Expand Down Expand Up @@ -167,7 +167,7 @@ private function request(string $method, string $url, array $params = []): array

return [
'status' => $info['http_code'],
'data' => $response ? json_decode((string) $response, flags: JSON_THROW_ON_ERROR) : '',
'data' => $response !== false ? json_decode((string) $response, flags: JSON_THROW_ON_ERROR) : '',
];
}

Expand Down
2 changes: 2 additions & 0 deletions src/Connection/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @codeCoverageIgnore
* @phpstan-ignore-file
*/
class Client extends BunnyClient

Check failure on line 21 in src/Connection/Client.php

View workflow job for this annotation

GitHub Actions / PHPStan

Unknown PHPDoc tag: @phpstan-ignore-file

Check failure on line 21 in src/Connection/Client.php

View workflow job for this annotation

GitHub Actions / PHPStan

Unknown PHPDoc tag: @phpstan-ignore-file
{
Expand Down Expand Up @@ -84,6 +85,7 @@ protected function write(): void
parent::write();

if (($last = error_get_last()) !== null) {
// @phpstan-ignore-next-line
if (!Strings::match($last['message'], '~fwrite\(\): Send of \d+ bytes failed with errno=\d+ broken pipe~i')) {

Check failure on line 89 in src/Connection/Client.php

View workflow job for this annotation

GitHub Actions / PHPStan

No error to ignore is reported on line 89.

Check failure on line 89 in src/Connection/Client.php

View workflow job for this annotation

GitHub Actions / PHPStan

No error to ignore is reported on line 89.
return;
}
Expand Down

0 comments on commit df670a8

Please sign in to comment.