From b8fb6f936490cd1dfacdef3e17a209cdaee072cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sun, 3 Aug 2014 13:30:07 +0200 Subject: [PATCH] strict callable type --- application/core/Bills/BillData.php | 4 ++-- application/core/Bills/BillManager.php | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/application/core/Bills/BillData.php b/application/core/Bills/BillData.php index 3129bcb5..b55a88a4 100644 --- a/application/core/Bills/BillData.php +++ b/application/core/Bills/BillData.php @@ -25,13 +25,13 @@ class BillData { /** * Construct new Bill Data Model * - * @param mixed $function + * @param callable $function * @param Player|string $player * @param int $amount * @param bool $pay * @param string $receiverLogin */ - public function __construct($function, $player, $amount, $pay = false, $receiverLogin = null) { + public function __construct(callable $function, $player, $amount, $pay = false, $receiverLogin = null) { $this->function = $function; $this->player = $player; $this->amount = $amount; diff --git a/application/core/Bills/BillManager.php b/application/core/Bills/BillManager.php index 2d700c19..61187652 100644 --- a/application/core/Bills/BillManager.php +++ b/application/core/Bills/BillManager.php @@ -54,11 +54,7 @@ class BillManager implements CallbackListener { * @param string $receiver * @return bool */ - public function sendBill($function, Player $player, $amount, $message, $receiver = '') { - if (!is_callable($function)) { - trigger_error("Function is not callable!"); - return false; - } + public function sendBill(callable $function, Player $player, $amount, $message, $receiver = '') { $bill = $this->maniaControl->getClient()->sendBill($player->login, $amount, $message, $receiver); $this->openBills[$bill] = new BillData($function, $player, $amount); return true;