X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FScopedCallback.php;h=ef22e0a30da9a82aef0fddbc4fe5f43da7b58552;hb=1782513c431dac352ee6563a9ec858d9a2b8a2b7;hp=8ecd87471a0f34ea442eddaf8a94e0fd0b91f3a8;hpb=aa7ab7328a600b4fbb5652bf233743cf89f5d51f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ScopedCallback.php b/includes/ScopedCallback.php index 8ecd87471a..ef22e0a30d 100644 --- a/includes/ScopedCallback.php +++ b/includes/ScopedCallback.php @@ -26,13 +26,17 @@ * @since 1.21 */ class ScopedCallback { - /** @var Closure */ + /** @var callable */ protected $callback; /** - * @param $callback Closure + * @param callable $callback + * @throws MWException */ - public function __construct( Closure $callback ) { + public function __construct( $callback ) { + if ( !is_callable( $callback ) ) { + throw new MWException( "Provided callback is not valid." ); + } $this->callback = $callback; }