Skip to content

Commit 0701fb5

Browse files
committed
Fix psalm issues
Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
1 parent 153b757 commit 0701fb5

File tree

7 files changed

+36
-32
lines changed

7 files changed

+36
-32
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"phpunit/phpunit": "^10.5",
5858
"psalm/plugin-phpunit": "^0.18.4",
5959
"swoole/ide-helper": "^5.0.3",
60-
"vimeo/psalm": "^5.12"
60+
"vimeo/psalm": "^5.19"
6161
},
6262
"suggest": {
6363
"ext-inotify": "To use inotify based file watcher. Required for hot code reloading.",

composer.lock

Lines changed: 18 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

psalm-baseline.xml

Lines changed: 17 additions & 9 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="5.12.0@f90118cdeacd0088e7215e64c0c99ceca819e176">
2+
<files psalm-version="5.19.0@06b71be009a6bd6d81b9811855d6629b9fe90e1b">
33
<file src="src/AbstractStaticResourceHandlerFactory.php">
44
<MixedArrayOffset>
55
<code>$cacheControlDirectives[$regex]</code>
@@ -26,14 +26,6 @@
2626
<code>InvalidConfigException</code>
2727
</UnusedClass>
2828
</file>
29-
<file src="src/HotCodeReload/FileWatcher/InotifyFileWatcher.php">
30-
<LessSpecificReturnStatement>
31-
<code>$paths</code>
32-
</LessSpecificReturnStatement>
33-
<MoreSpecificReturnType>
34-
<code><![CDATA[list<non-empty-string>]]></code>
35-
</MoreSpecificReturnType>
36-
</file>
3729
<file src="src/HttpServerFactory.php">
3830
<InvalidConstantAssignmentValue>
3931
<code>PROTOCOLS = [
@@ -90,11 +82,17 @@
9082
</MixedPropertyTypeCoercion>
9183
</file>
9284
<file src="src/StaticResourceHandler/CacheControlMiddleware.php">
85+
<ArgumentTypeCoercion>
86+
<code>$regexp</code>
87+
</ArgumentTypeCoercion>
9388
<MixedPropertyTypeCoercion>
9489
<code>$cacheControlDirectives</code>
9590
</MixedPropertyTypeCoercion>
9691
</file>
9792
<file src="src/StaticResourceHandler/ETagMiddleware.php">
93+
<ArgumentTypeCoercion>
94+
<code>$regexp</code>
95+
</ArgumentTypeCoercion>
9896
<MixedPropertyTypeCoercion>
9997
<code>$etagDirectives</code>
10098
</MixedPropertyTypeCoercion>
@@ -118,6 +116,16 @@
118116
<code>stream_filter_append</code>
119117
</UnusedFunctionCall>
120118
</file>
119+
<file src="src/StaticResourceHandler/LastModifiedMiddleware.php">
120+
<ArgumentTypeCoercion>
121+
<code>$regexp</code>
122+
</ArgumentTypeCoercion>
123+
</file>
124+
<file src="src/StaticResourceHandler/ValidateRegexTrait.php">
125+
<ArgumentTypeCoercion>
126+
<code>$regex</code>
127+
</ArgumentTypeCoercion>
128+
</file>
121129
<file src="src/SwooleEmitter.php">
122130
<PossiblyNullReference>
123131
<code>asString</code>

test/HttpServerFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Swoole\Process;
2121
use Swoole\Runtime as SwooleRuntime;
2222
use Throwable;
23-
use Webmozart\Assert\Assert;
2423

2524
use function array_merge;
2625
use function defined;
@@ -341,13 +340,11 @@ public function testFactoryCanEnableCoroutines(): void
341340

342341
$i = 0;
343342
go(static function () use (&$i): void {
344-
Assert::integer($i);
345343
usleep(1000);
346344
++$i;
347345
SwooleEvent::exit();
348346
});
349347
go(function () use (&$i): void {
350-
Assert::integer($i);
351348
++$i;
352349
$this->assertEquals(1, $i);
353350
});

test/StaticResourceHandler/GzipMiddlewareTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public function testResponseContentCallbackEmitsExpectedHeadersAndCompressesCont
161161
string|array $value,
162162
bool $format = true
163163
) use (&$actualHeaderCalls): bool {
164-
/** @psalm-var array $actualHeaderCalls */
165164
$actualHeaderCalls[] = [$key, $value, $format];
166165
return true;
167166
});

test/StaticResourceHandler/StaticResourceResponseTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function testSendSwooleResponsePopulatesStatusAndHeadersAndCallsContentCa
3535
string|array $value,
3636
bool $format = true
3737
) use (&$actualHeaderCalls): bool {
38-
/** @psalm-var array $actualHeaderCalls */
3938
$actualHeaderCalls[] = [$key, $value, $format];
4039
return true;
4140
});
@@ -78,7 +77,6 @@ public function testSendSwooleResponseSkipsSendingContentWhenContentDisabled():
7877
string|array $value,
7978
bool $format = true
8079
) use (&$actualHeaderCalls): bool {
81-
/** @psalm-var array $actualHeaderCalls */
8280
$actualHeaderCalls[] = [$key, $value, $format];
8381
return true;
8482
});

test/SwooleEmitterTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function testMultipleHeaders(): void
8686
string $key,
8787
string|array $value
8888
) use (&$actualHeaderCalls): bool {
89-
/** @psalm-var array $actualHeaderCalls */
9089
$actualHeaderCalls[] = [$key, $value];
9190
return true;
9291
});
@@ -152,7 +151,6 @@ public function testMultipleSetCookieHeaders(): void
152151
bool $httponly = false,
153152
string $samesite = ''
154153
) use (&$actualCookieCalls): bool {
155-
/** @psalm-var array $actualCookieCalls */
156154
$actualCookieCalls[] = [$name, $value, $expires, $path, $domain, $secure, $httponly, $samesite];
157155
return true;
158156
});

0 commit comments

Comments
 (0)