From b78ff0041811abed22e17f33c463373b34855771 Mon Sep 17 00:00:00 2001 From: ShockedPlot7560 Date: Sun, 22 Oct 2023 15:06:17 +0200 Subject: [PATCH] fix style --- src/event/AsyncEventDelegate.php | 8 ++++---- src/event/Event.php | 2 +- src/event/RegisteredAsyncListener.php | 2 +- src/plugin/PluginManager.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/event/AsyncEventDelegate.php b/src/event/AsyncEventDelegate.php index 1811e349a..661ae8f3a 100644 --- a/src/event/AsyncEventDelegate.php +++ b/src/event/AsyncEventDelegate.php @@ -42,7 +42,7 @@ final class AsyncEventDelegate extends Event{ /** * @phpstan-return Promise */ - public function callAsync() : Promise { + public function callAsync() : Promise{ $this->promises->clear(); return $this->callDepth($this->callAsyncDepth(...)); } @@ -75,7 +75,7 @@ final class AsyncEventDelegate extends Event{ /** * @phpstan-return Promise */ - private function callPriority(int $priority) : Promise { + private function callPriority(int $priority) : Promise{ $handlers = HandlerListManager::global()->getListFor($this->event::class)->getListenersByPriority($priority); /** @phpstan-var PromiseResolver $resolver */ @@ -102,7 +102,7 @@ final class AsyncEventDelegate extends Event{ $resolver->reject(); }); }else{ - $this->waitForPromises()->onCompletion(function() use (&$nonConcurrentHandlers, $testResolve) { + $this->waitForPromises()->onCompletion(function() use (&$nonConcurrentHandlers, $testResolve){ $handler = array_shift($nonConcurrentHandlers); if($handler instanceof RegisteredAsyncListener){ $this->promises->add($handler->callAsync($this->event)); @@ -122,7 +122,7 @@ final class AsyncEventDelegate extends Event{ /** * @phpstan-return Promise */ - private function waitForPromises() : Promise { + private function waitForPromises() : Promise{ $array = $this->promises->toArray(); $this->promises->clear(); diff --git a/src/event/Event.php b/src/event/Event.php index 6ba39031a..660290a60 100644 --- a/src/event/Event.php +++ b/src/event/Event.php @@ -47,7 +47,7 @@ abstract class Event{ * @throws \RuntimeException if event call recursion reaches the max depth limit */ public function call() : void{ - $this->callDepth(function() { + $this->callDepth(function(){ $handlers = HandlerListManager::global()->getHandlersFor(static::class); foreach($handlers as $registration){ diff --git a/src/event/RegisteredAsyncListener.php b/src/event/RegisteredAsyncListener.php index e5bbde84b..a9fd77f80 100644 --- a/src/event/RegisteredAsyncListener.php +++ b/src/event/RegisteredAsyncListener.php @@ -38,7 +38,7 @@ class RegisteredAsyncListener extends RegisteredListener{ private bool $noConcurrentCall, TimingsHandler $timings ){ - $handler = function(AsyncEvent&Event $event) use($handler) : void { + $handler = function(AsyncEvent&Event $event) use($handler) : void{ $this->returnPromise = $handler($event); if(!$this->returnPromise instanceof Promise){ throw new \TypeError("Async event handler must return a Promise"); diff --git a/src/plugin/PluginManager.php b/src/plugin/PluginManager.php index f918d916a..9d0d42827 100644 --- a/src/plugin/PluginManager.php +++ b/src/plugin/PluginManager.php @@ -692,7 +692,7 @@ class PluginManager{ * @phpstan-template TEvent of Event * @phpstan-param (\Closure(TEvent) : void)|(\Closure(AsyncEvent&TEvent) : Promise) $handler */ - private function canHandleAsyncEvent(\Closure $handler) : bool { + private function canHandleAsyncEvent(\Closure $handler) : bool{ $reflection = new \ReflectionFunction($handler); $return = $reflection->getReturnType();