mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +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:
parent
912e612743
commit
2696698926
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user