From 618f17868a939681092883c1d1e1484dd70982ab Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 26 Jul 2024 17:03:49 +0545 Subject: [PATCH] chore: introduce more deprecated things --- lib/EmitterInterface.php | 2 +- lib/EmitterTrait.php | 2 +- lib/Promise.php | 6 +++--- lib/WildcardEmitterTrait.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/EmitterInterface.php b/lib/EmitterInterface.php index 9cf5bcd..6ce0f34 100644 --- a/lib/EmitterInterface.php +++ b/lib/EmitterInterface.php @@ -47,7 +47,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool; + public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool; /** * Returns the list of listeners for an event. diff --git a/lib/EmitterTrait.php b/lib/EmitterTrait.php index cc1f55c..5502ef9 100644 --- a/lib/EmitterTrait.php +++ b/lib/EmitterTrait.php @@ -73,7 +73,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool + public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool { if (\is_null($continueCallBack)) { foreach ($this->listeners($eventName) as $listener) { diff --git a/lib/Promise.php b/lib/Promise.php index 70921d0..b582126 100644 --- a/lib/Promise.php +++ b/lib/Promise.php @@ -58,7 +58,7 @@ class Promise * Each are callbacks that map to $this->fulfill and $this->reject. * Using the executor is optional. */ - public function __construct(?callable $executor = null) + public function __construct(callable $executor = null) { if ($executor) { $executor( @@ -87,7 +87,7 @@ public function __construct(?callable $executor = null) * If either of the callbacks throw an exception, the returned promise will * be rejected and the exception will be passed back. */ - public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise + public function then(callable $onFulfilled = null, callable $onRejected = null): Promise { // This new subPromise will be returned from this function, and will // be fulfilled with the result of the onFulfilled or onRejected event @@ -220,7 +220,7 @@ public function wait() * correctly, and any chained promises are also correctly fulfilled or * rejected. */ - private function invokeCallback(Promise $subPromise, ?callable $callBack = null) + private function invokeCallback(Promise $subPromise, callable $callBack = null) { // We use 'nextTick' to ensure that the event handlers are always // triggered outside of the calling stack in which they were originally diff --git a/lib/WildcardEmitterTrait.php b/lib/WildcardEmitterTrait.php index 69243ff..206a8f3 100644 --- a/lib/WildcardEmitterTrait.php +++ b/lib/WildcardEmitterTrait.php @@ -82,7 +82,7 @@ public function once(string $eventName, callable $callBack, int $priority = 100) * Lastly, if there are 5 event handlers for an event. The continueCallback * will be called at most 4 times. */ - public function emit(string $eventName, array $arguments = [], ?callable $continueCallBack = null): bool + public function emit(string $eventName, array $arguments = [], callable $continueCallBack = null): bool { if (\is_null($continueCallBack)) { foreach ($this->listeners($eventName) as $listener) { @@ -195,7 +195,7 @@ public function removeListener(string $eventName, callable $listener): bool * removed. If it is not specified, every listener for every event is * removed. */ - public function removeAllListeners(?string $eventName = null) + public function removeAllListeners(string $eventName = null) { if (\is_null($eventName)) { $this->listeners = [];