event: modernize property declarations where possible

only private fields are modified; protected ones can't be changed in case someone extended the classes
This commit is contained in:
Dylan K. Taylor
2022-04-25 00:06:26 +01:00
parent ded7e24f67
commit c8a7a53d70
58 changed files with 258 additions and 444 deletions

View File

@ -39,15 +39,12 @@ class EntityRegainHealthEvent extends EntityEvent implements Cancellable{
public const CAUSE_CUSTOM = 3;
public const CAUSE_SATURATION = 4;
/** @var float */
private $amount;
/** @var int */
private $reason;
public function __construct(Entity $entity, float $amount, int $regainReason){
public function __construct(
Entity $entity,
private float $amount,
private int $regainReason
){
$this->entity = $entity;
$this->amount = $amount;
$this->reason = $regainReason;
}
public function getAmount() : float{
@ -62,6 +59,6 @@ class EntityRegainHealthEvent extends EntityEvent implements Cancellable{
* Returns one of the CAUSE_* constants to indicate why this regeneration occurred.
*/
public function getRegainReason() : int{
return $this->reason;
return $this->regainReason;
}
}