Skip to content

Commit

Permalink
Merge branch 'main' into rethrow-from-suspension
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
trowski committed Nov 18, 2023
2 parents cfed1a9 + c29e030 commit 51e378b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"ext-json": "*",
"phpunit/phpunit": "^9",
"jetbrains/phpstorm-stubs": "^2019.3",
"psalm/phar": "^5"
"psalm/phar": "^5.15"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<file name="src/EventLoop/Driver/UvDriver.php"/>
</errorLevel>
</PossiblyInvalidArgument>

<UnsupportedPropertyReferenceUsage>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</UnsupportedPropertyReferenceUsage>
</issueHandlers>

<stubs>
Expand Down
2 changes: 1 addition & 1 deletion src/EventLoop/Driver/StreamSelectDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private function selectStreams(array $read, array $write, float $timeout): void
}

if ($timeout > 0) { // Sleep until next timer expires.
/** @psalm-var positive-int $timeout */
/** @psalm-suppress ArgumentTypeCoercion $timeout is positive here. */
\usleep((int) ($timeout * 1_000_000));
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/EventLoop/Driver/TracingDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,15 @@ private function getCancelTrace(string $callbackId): string
/**
* Formats a stacktrace obtained via `debug_backtrace()`.
*
* @param array<array{file?: string, line: int, type?: string, class?: class-string, function: string}> $trace
* Output of `debug_backtrace()`.
* @param list<array{
* args?: list<mixed>,
* class?: class-string,
* file?: string,
* function: string,
* line?: int,
* object?: object,
* type?: string
* }> $trace Output of `debug_backtrace()`.
*
* @return string Formatted stacktrace.
*/
Expand All @@ -259,7 +266,7 @@ private function formatStacktrace(array $trace): string
return \implode("\n", \array_map(static function ($e, $i) {
$line = "#{$i} ";

if (isset($e["file"])) {
if (isset($e["file"], $e['line'])) {
$line .= "{$e['file']}:{$e['line']} ";
}

Expand Down
1 change: 1 addition & 0 deletions src/EventLoop/Internal/AbstractDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ private function createLoopFiber(): void
// Invoke microtasks if we have some
$this->invokeCallbacks();

/** @psalm-suppress RedundantCondition $this->stopped may be changed by $this->invokeCallbacks(). */
while (!$this->stopped) {
if ($this->interrupt) {
$this->invokeInterrupt();
Expand Down

0 comments on commit 51e378b

Please sign in to comment.