mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-25 14:57:08 +00:00
fix style
This commit is contained in:
parent
9b2b92ac1f
commit
b78ff00418
@ -42,7 +42,7 @@ final class AsyncEventDelegate extends Event{
|
||||
/**
|
||||
* @phpstan-return Promise<null>
|
||||
*/
|
||||
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<null>
|
||||
*/
|
||||
private function callPriority(int $priority) : Promise {
|
||||
private function callPriority(int $priority) : Promise{
|
||||
$handlers = HandlerListManager::global()->getListFor($this->event::class)->getListenersByPriority($priority);
|
||||
|
||||
/** @phpstan-var PromiseResolver<null> $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<null>
|
||||
*/
|
||||
private function waitForPromises() : Promise {
|
||||
private function waitForPromises() : Promise{
|
||||
$array = $this->promises->toArray();
|
||||
$this->promises->clear();
|
||||
|
||||
|
@ -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){
|
||||
|
@ -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");
|
||||
|
@ -692,7 +692,7 @@ class PluginManager{
|
||||
* @phpstan-template TEvent of Event
|
||||
* @phpstan-param (\Closure(TEvent) : void)|(\Closure(AsyncEvent&TEvent) : Promise<null>) $handler
|
||||
*/
|
||||
private function canHandleAsyncEvent(\Closure $handler) : bool {
|
||||
private function canHandleAsyncEvent(\Closure $handler) : bool{
|
||||
$reflection = new \ReflectionFunction($handler);
|
||||
$return = $reflection->getReturnType();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user