Skip to content

Commit

Permalink
Fix psalm issues
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
  • Loading branch information
Xerkus committed Jan 11, 2024
1 parent 153b757 commit 0701fb5
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"phpunit/phpunit": "^10.5",
"psalm/plugin-phpunit": "^0.18.4",
"swoole/ide-helper": "^5.0.3",
"vimeo/psalm": "^5.12"
"vimeo/psalm": "^5.19"
},
"suggest": {
"ext-inotify": "To use inotify based file watcher. Required for hot code reloading.",
Expand Down
32 changes: 18 additions & 14 deletions composer.lock

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

26 changes: 17 additions & 9 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.12.0@f90118cdeacd0088e7215e64c0c99ceca819e176">
<files psalm-version="5.19.0@06b71be009a6bd6d81b9811855d6629b9fe90e1b">
<file src="src/AbstractStaticResourceHandlerFactory.php">
<MixedArrayOffset>
<code>$cacheControlDirectives[$regex]</code>
Expand All @@ -26,14 +26,6 @@
<code>InvalidConfigException</code>
</UnusedClass>
</file>
<file src="src/HotCodeReload/FileWatcher/InotifyFileWatcher.php">
<LessSpecificReturnStatement>
<code>$paths</code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[list<non-empty-string>]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/HttpServerFactory.php">
<InvalidConstantAssignmentValue>
<code>PROTOCOLS = [
Expand Down Expand Up @@ -90,11 +82,17 @@
</MixedPropertyTypeCoercion>
</file>
<file src="src/StaticResourceHandler/CacheControlMiddleware.php">
<ArgumentTypeCoercion>
<code>$regexp</code>
</ArgumentTypeCoercion>
<MixedPropertyTypeCoercion>
<code>$cacheControlDirectives</code>
</MixedPropertyTypeCoercion>
</file>
<file src="src/StaticResourceHandler/ETagMiddleware.php">
<ArgumentTypeCoercion>
<code>$regexp</code>
</ArgumentTypeCoercion>
<MixedPropertyTypeCoercion>
<code>$etagDirectives</code>
</MixedPropertyTypeCoercion>
Expand All @@ -118,6 +116,16 @@
<code>stream_filter_append</code>
</UnusedFunctionCall>
</file>
<file src="src/StaticResourceHandler/LastModifiedMiddleware.php">
<ArgumentTypeCoercion>
<code>$regexp</code>
</ArgumentTypeCoercion>
</file>
<file src="src/StaticResourceHandler/ValidateRegexTrait.php">
<ArgumentTypeCoercion>
<code>$regex</code>
</ArgumentTypeCoercion>
</file>
<file src="src/SwooleEmitter.php">
<PossiblyNullReference>
<code>asString</code>
Expand Down
3 changes: 0 additions & 3 deletions test/HttpServerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Swoole\Process;
use Swoole\Runtime as SwooleRuntime;
use Throwable;
use Webmozart\Assert\Assert;

use function array_merge;
use function defined;
Expand Down Expand Up @@ -341,13 +340,11 @@ public function testFactoryCanEnableCoroutines(): void

$i = 0;
go(static function () use (&$i): void {
Assert::integer($i);
usleep(1000);
++$i;
SwooleEvent::exit();
});
go(function () use (&$i): void {
Assert::integer($i);
++$i;
$this->assertEquals(1, $i);
});
Expand Down
1 change: 0 additions & 1 deletion test/StaticResourceHandler/GzipMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public function testResponseContentCallbackEmitsExpectedHeadersAndCompressesCont
string|array $value,
bool $format = true
) use (&$actualHeaderCalls): bool {
/** @psalm-var array $actualHeaderCalls */
$actualHeaderCalls[] = [$key, $value, $format];
return true;
});
Expand Down
2 changes: 0 additions & 2 deletions test/StaticResourceHandler/StaticResourceResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function testSendSwooleResponsePopulatesStatusAndHeadersAndCallsContentCa
string|array $value,
bool $format = true
) use (&$actualHeaderCalls): bool {
/** @psalm-var array $actualHeaderCalls */
$actualHeaderCalls[] = [$key, $value, $format];
return true;
});
Expand Down Expand Up @@ -78,7 +77,6 @@ public function testSendSwooleResponseSkipsSendingContentWhenContentDisabled():
string|array $value,
bool $format = true
) use (&$actualHeaderCalls): bool {
/** @psalm-var array $actualHeaderCalls */
$actualHeaderCalls[] = [$key, $value, $format];
return true;
});
Expand Down
2 changes: 0 additions & 2 deletions test/SwooleEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function testMultipleHeaders(): void
string $key,
string|array $value
) use (&$actualHeaderCalls): bool {
/** @psalm-var array $actualHeaderCalls */
$actualHeaderCalls[] = [$key, $value];
return true;
});
Expand Down Expand Up @@ -152,7 +151,6 @@ public function testMultipleSetCookieHeaders(): void
bool $httponly = false,
string $samesite = ''
) use (&$actualCookieCalls): bool {
/** @psalm-var array $actualCookieCalls */
$actualCookieCalls[] = [$name, $value, $expires, $path, $domain, $secure, $httponly, $samesite];
return true;
});
Expand Down

0 comments on commit 0701fb5

Please sign in to comment.