mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Added typehints and PhpDoc for events API
excluded blocks and entities events API to avoid merge conflicts
This commit is contained in:
@ -44,7 +44,7 @@ abstract class Event{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
final public function getEventName(){
|
||||
final public function getEventName() : string{
|
||||
return $this->eventName === null ? get_class($this) : $this->eventName;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ abstract class Event{
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function isCancelled(){
|
||||
public function isCancelled() : bool{
|
||||
if(!($this instanceof Cancellable)){
|
||||
throw new \BadMethodCallException("Event is not Cancellable");
|
||||
}
|
||||
@ -67,19 +67,19 @@ abstract class Event{
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function setCancelled($value = true){
|
||||
public function setCancelled(bool $value = true){
|
||||
if(!($this instanceof Cancellable)){
|
||||
throw new \BadMethodCallException("Event is not Cancellable");
|
||||
}
|
||||
|
||||
/** @var Event $this */
|
||||
$this->isCancelled = (bool) $value;
|
||||
$this->isCancelled = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HandlerList
|
||||
*/
|
||||
public function getHandlers(){
|
||||
public function getHandlers() : HandlerList{
|
||||
if(static::$handlerList === null){
|
||||
static::$handlerList = new HandlerList();
|
||||
}
|
||||
|
Reference in New Issue
Block a user