mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
ClosureTask: relax closure checks to allow arrow functions without return typehints
nobody uses return typehints on arrow functions anyway .. they just waste space.
This commit is contained in:
@@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\scheduler;
|
namespace pocketmine\scheduler;
|
||||||
|
|
||||||
|
use DaveRandom\CallbackValidator\CallbackType;
|
||||||
|
use DaveRandom\CallbackValidator\ReturnType;
|
||||||
use pocketmine\utils\Utils;
|
use pocketmine\utils\Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +51,7 @@ class ClosureTask extends Task{
|
|||||||
* @phpstan-param \Closure() : void $closure
|
* @phpstan-param \Closure() : void $closure
|
||||||
*/
|
*/
|
||||||
public function __construct(\Closure $closure){
|
public function __construct(\Closure $closure){
|
||||||
Utils::validateCallableSignature(function() : void{}, $closure);
|
Utils::validateCallableSignature(new CallbackType(new ReturnType()), $closure);
|
||||||
$this->closure = $closure;
|
$this->closure = $closure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user