mirror of
https://github.com/danog/amp.git
synced 2024-12-02 17:37:50 +01:00
Fix some Psalm issues
This commit is contained in:
parent
d70896df73
commit
49f5a5951a
@ -135,6 +135,7 @@ final class Future
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
/** @var T $value */
|
||||||
$state->complete($onComplete($value));
|
$state->complete($onComplete($value));
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$state->error($exception);
|
$state->error($exception);
|
||||||
|
@ -18,8 +18,7 @@ final class Cancellable implements Cancellation
|
|||||||
/** @var callable[] */
|
/** @var callable[] */
|
||||||
private array $callbacks = [];
|
private array $callbacks = [];
|
||||||
|
|
||||||
/** @var \Throwable|null */
|
private ?CancelledException $exception = null;
|
||||||
private ?\Throwable $exception = null;
|
|
||||||
|
|
||||||
public function cancel(?\Throwable $previous = null): void
|
public function cancel(?\Throwable $previous = null): void
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ final class FutureState
|
|||||||
private bool $handled = false;
|
private bool $handled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array<string, callable(?\Throwable, ?T, string): void>
|
* @var array<string, \Closure(?\Throwable, ?T, string): void>
|
||||||
*/
|
*/
|
||||||
private array $callbacks = [];
|
private array $callbacks = [];
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ final class FutureState
|
|||||||
*
|
*
|
||||||
* The callback is invoked directly from the event loop context, so suspension within the callback is not possible.
|
* The callback is invoked directly from the event loop context, so suspension within the callback is not possible.
|
||||||
*
|
*
|
||||||
* @param callable(?\Throwable, ?T, string): void $callback Callback invoked on error / successful completion of
|
* @param \Closure(?\Throwable, ?T, string): void $callback Callback invoked on error / successful completion of
|
||||||
* the future.
|
* the future.
|
||||||
*
|
*
|
||||||
* @return string Identifier that can be used to cancel interest for this future.
|
* @return string Identifier that can be used to cancel interest for this future.
|
||||||
*/
|
*/
|
||||||
public function subscribe(callable $callback): string
|
public function subscribe(\Closure $callback): string
|
||||||
{
|
{
|
||||||
$id = self::$nextId++;
|
$id = self::$nextId++;
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ namespace Amp\Internal;
|
|||||||
/**
|
/**
|
||||||
* Formats a stacktrace obtained via `debug_backtrace()`.
|
* Formats a stacktrace obtained via `debug_backtrace()`.
|
||||||
*
|
*
|
||||||
* @param array<array{file?: string, line: int, type?: string, class: string, function: string}> $trace Output of
|
* @param list<array{args?:list<mixed>, class?: class-string, file: string, function: string, line: int, object?: object, type?: string}> $trace
|
||||||
* `debug_backtrace()`.
|
* Output of `debug_backtrace()`.
|
||||||
*
|
*
|
||||||
* @return string Formatted stacktrace.
|
* @return string Formatted stacktrace.
|
||||||
*
|
*
|
||||||
@ -22,7 +22,7 @@ function formatStacktrace(array $trace): string
|
|||||||
$line .= "{$e['file']}:{$e['line']} ";
|
$line .= "{$e['file']}:{$e['line']} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($e["type"])) {
|
if (isset($e["class"], $e["type"])) {
|
||||||
$line .= $e["class"] . $e["type"];
|
$line .= $e["class"] . $e["type"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user