Skip to content

Commit c29e030

Browse files
committed
Upgrade Psalm to 5.x
1 parent 136e973 commit c29e030

File tree

7 files changed

+23
-9
lines changed

7 files changed

+23
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"ext-json": "*",
3737
"phpunit/phpunit": "^9",
3838
"jetbrains/phpstorm-stubs": "^2019.3",
39-
"psalm/phar": "^4.7"
39+
"psalm/phar": "^5.15"
4040
},
4141
"autoload": {
4242
"psr-4": {

psalm.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
<file name="src/EventLoop/Driver/UvDriver.php"/>
6060
</errorLevel>
6161
</PossiblyInvalidArgument>
62+
63+
<UnsupportedPropertyReferenceUsage>
64+
<errorLevel type="suppress">
65+
<directory name="src"/>
66+
</errorLevel>
67+
</UnsupportedPropertyReferenceUsage>
6268
</issueHandlers>
6369

6470
<stubs>

src/EventLoop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public static function getType(string $callbackId): CallbackType
346346
*
347347
* @param string $callbackId The callback identifier.
348348
*
349-
* @return bool {@code true} if the callback is currently enabled, otherwise {@code false}.
349+
* @return bool `true` if the callback is currently enabled, otherwise `false`.
350350
*/
351351
public static function isEnabled(string $callbackId): bool
352352
{
@@ -358,7 +358,7 @@ public static function isEnabled(string $callbackId): bool
358358
*
359359
* @param string $callbackId The callback identifier.
360360
*
361-
* @return bool {@code true} if the callback is currently referenced, otherwise {@code false}.
361+
* @return bool `true` if the callback is currently referenced, otherwise `false`.
362362
*/
363363
public static function isReferenced(string $callbackId): bool
364364
{

src/EventLoop/Driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function getType(string $callbackId): CallbackType;
294294
*
295295
* @param string $callbackId The callback identifier.
296296
*
297-
* @return bool {@code true} if the callback is currently enabled, otherwise {@code false}.
297+
* @return bool `true` if the callback is currently enabled, otherwise `false`.
298298
*/
299299
public function isEnabled(string $callbackId): bool;
300300

@@ -303,7 +303,7 @@ public function isEnabled(string $callbackId): bool;
303303
*
304304
* @param string $callbackId The callback identifier.
305305
*
306-
* @return bool {@code true} if the callback is currently referenced, otherwise {@code false}.
306+
* @return bool `true` if the callback is currently referenced, otherwise `false`.
307307
*/
308308
public function isReferenced(string $callbackId): bool;
309309

src/EventLoop/Driver/StreamSelectDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function selectStreams(array $read, array $write, float $timeout): void
304304
}
305305

306306
if ($timeout > 0) { // Sleep until next timer expires.
307-
/** @psalm-var positive-int $timeout */
307+
/** @psalm-suppress ArgumentTypeCoercion $timeout is positive here. */
308308
\usleep((int) ($timeout * 1_000_000));
309309
}
310310
}

src/EventLoop/Driver/TracingDriver.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,15 @@ private function getCancelTrace(string $callbackId): string
249249
/**
250250
* Formats a stacktrace obtained via `debug_backtrace()`.
251251
*
252-
* @param array<array{file?: string, line: int, type?: string, class?: class-string, function: string}> $trace
253-
* Output of `debug_backtrace()`.
252+
* @param list<array{
253+
* args?: list<mixed>,
254+
* class?: class-string,
255+
* file?: string,
256+
* function: string,
257+
* line?: int,
258+
* object?: object,
259+
* type?: string
260+
* }> $trace Output of `debug_backtrace()`.
254261
*
255262
* @return string Formatted stacktrace.
256263
*/
@@ -259,7 +266,7 @@ private function formatStacktrace(array $trace): string
259266
return \implode("\n", \array_map(static function ($e, $i) {
260267
$line = "#{$i} ";
261268

262-
if (isset($e["file"])) {
269+
if (isset($e["file"], $e['line'])) {
263270
$line .= "{$e['file']}:{$e['line']} ";
264271
}
265272

src/EventLoop/Internal/AbstractDriver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ private function createLoopFiber(): void
533533
// Invoke microtasks if we have some
534534
$this->invokeCallbacks();
535535

536+
/** @psalm-suppress RedundantCondition $this->stopped may be changed by $this->invokeCallbacks(). */
536537
while (!$this->stopped) {
537538
if ($this->interrupt) {
538539
$this->invokeInterrupt();

0 commit comments

Comments
 (0)