strict callable type
This commit is contained in:
		| @@ -25,13 +25,13 @@ class BillData { | |||||||
| 	/** | 	/** | ||||||
| 	 * Construct new Bill Data Model | 	 * Construct new Bill Data Model | ||||||
| 	 * | 	 * | ||||||
| 	 * @param mixed         $function | 	 * @param callable      $function | ||||||
| 	 * @param Player|string $player | 	 * @param Player|string $player | ||||||
| 	 * @param int           $amount | 	 * @param int           $amount | ||||||
| 	 * @param bool          $pay | 	 * @param bool          $pay | ||||||
| 	 * @param string        $receiverLogin | 	 * @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->function      = $function; | ||||||
| 		$this->player        = $player; | 		$this->player        = $player; | ||||||
| 		$this->amount        = $amount; | 		$this->amount        = $amount; | ||||||
|   | |||||||
| @@ -54,11 +54,7 @@ class BillManager implements CallbackListener { | |||||||
| 	 * @param string   $receiver | 	 * @param string   $receiver | ||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendBill($function, Player $player, $amount, $message, $receiver = '') { | 	public function sendBill(callable $function, Player $player, $amount, $message, $receiver = '') { | ||||||
| 		if (!is_callable($function)) { |  | ||||||
| 			trigger_error("Function is not callable!"); |  | ||||||
| 			return false; |  | ||||||
| 		} |  | ||||||
| 		$bill                   = $this->maniaControl->getClient()->sendBill($player->login, $amount, $message, $receiver); | 		$bill                   = $this->maniaControl->getClient()->sendBill($player->login, $amount, $message, $receiver); | ||||||
| 		$this->openBills[$bill] = new BillData($function, $player, $amount); | 		$this->openBills[$bill] = new BillData($function, $player, $amount); | ||||||
| 		return true; | 		return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user