From 5b283d69e9ea50a4b6de6b832e613a319f87f6f9 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Sat, 14 May 2016 17:14:33 -0500 Subject: [PATCH] Define watcher callback signatures --- src/Loop.php | 14 +++++++------- src/LoopDriver.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Loop.php b/src/Loop.php index 16f6c83..b59baea 100644 --- a/src/Loop.php +++ b/src/Loop.php @@ -59,7 +59,7 @@ final class Loop /** * Defer the execution of a callback. * - * @param callable $callback The callback to defer. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to defer. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -72,7 +72,7 @@ final class Loop /** * Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed. * - * @param callable $callback The callback to delay. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to delay. * @param int $time The amount of time, in milliseconds, to delay the execution for. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * @@ -86,7 +86,7 @@ final class Loop /** * Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed. * - * @param callable $callback The callback to repeat. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to repeat. * @param int $interval The time interval, in milliseconds, to wait between executions. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * @@ -101,7 +101,7 @@ final class Loop * Execute a callback when a stream resource becomes readable. * * @param resource $stream The stream to monitor. - * @param callable $callback The callback to execute. + * @param callable(resource $stream, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -115,7 +115,7 @@ final class Loop * Execute a callback when a stream resource becomes writable. * * @param resource $stream The stream to monitor. - * @param callable $callback The callback to execute. + * @param callable(resource $stream, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -129,7 +129,7 @@ final class Loop * Execute a callback when a signal is received. * * @param int $signo The signal number to monitor. - * @param callable $callback The callback to execute. + * @param callable(int $signo, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -142,7 +142,7 @@ final class Loop /** * Execute a callback when an error occurs. * - * @param callable $callback The callback to execute. + * @param callable(\Throwable|\Exception $exception) $callback The callback to execute. * * @return string An identifier that can be used to cancel, enable or disable the event. */ diff --git a/src/LoopDriver.php b/src/LoopDriver.php index 3e94763..5f04b90 100644 --- a/src/LoopDriver.php +++ b/src/LoopDriver.php @@ -23,7 +23,7 @@ interface LoopDriver /** * Defer the execution of a callback. * - * @param callable $callback The callback to defer. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to defer. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -33,7 +33,7 @@ interface LoopDriver /** * Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed. * - * @param callable $callback The callback to delay. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to delay. * @param int $delay The amount of time, in milliseconds, to delay the execution for. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * @@ -44,7 +44,7 @@ interface LoopDriver /** * Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed. * - * @param callable $callback The callback to repeat. + * @param callable(mixed $data, string $watcherIdentifier) $callback The callback to repeat. * @param int $interval The time interval, in milliseconds, to wait between executions. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * @@ -56,7 +56,7 @@ interface LoopDriver * Execute a callback when a stream resource becomes readable. * * @param resource $stream The stream to monitor. - * @param callable $callback The callback to execute. + * @param callable(resource $stream, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -67,7 +67,7 @@ interface LoopDriver * Execute a callback when a stream resource becomes writable. * * @param resource $stream The stream to monitor. - * @param callable $callback The callback to execute. + * @param callable(resource $stream, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -78,7 +78,7 @@ interface LoopDriver * Execute a callback when a signal is received. * * @param int $signo The signal number to monitor. - * @param callable $callback The callback to execute. + * @param callable(int $signo, mixed $data, string $watcherIdentifier) $callback The callback to execute. * @param mixed $data Arbitrary data given to the callback function as the $data parameter. * * @return string An identifier that can be used to cancel, enable or disable the event. @@ -88,7 +88,7 @@ interface LoopDriver /** * Execute a callback when an error occurs. * - * @param callable $callback The callback to execute. + * @param callable(\Throwable|\Exception $exception) $callback The callback to execute. * * @return string An identifier that can be used to cancel, enable or disable the event. */