Modernize property type declarations

This commit is contained in:
Dylan K. Taylor
2022-06-04 18:16:32 +01:00
parent 23695fb900
commit 083a35f970
114 changed files with 431 additions and 863 deletions

View File

@ -35,30 +35,22 @@ use pocketmine\player\Player;
class BlockBreakEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
protected $player;
/** @var Item */
protected $item;
/** @var bool */
protected $instaBreak = false;
/** @var Item[] */
protected $blockDrops = [];
/** @var int */
protected $xpDrops;
protected array $blockDrops = [];
/**
* @param Item[] $drops
*/
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0){
public function __construct(
protected Player $player,
Block $block,
protected Item $item,
protected bool $instaBreak = false,
array $drops = [],
protected int $xpDrops = 0
){
parent::__construct($block);
$this->item = $item;
$this->player = $player;
$this->instaBreak = $instaBreak;
$this->setDrops($drops);
$this->xpDrops = $xpDrops;
}
/**

View File

@ -30,12 +30,9 @@ use pocketmine\block\Block;
use pocketmine\event\Event;
abstract class BlockEvent extends Event{
/** @var Block */
protected $block;
public function __construct(Block $block){
$this->block = $block;
}
public function __construct(
protected Block $block
){}
public function getBlock() : Block{
return $this->block;

View File

@ -35,23 +35,14 @@ use pocketmine\player\Player;
class BlockPlaceEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
protected $player;
/** @var Item */
protected $item;
/** @var Block */
protected $blockReplace;
/** @var Block */
protected $blockAgainst;
public function __construct(Player $player, Block $blockPlace, Block $blockReplace, Block $blockAgainst, Item $item){
public function __construct(
protected Player $player,
Block $blockPlace,
protected Block $blockReplace,
protected Block $blockAgainst,
protected Item $item
){
parent::__construct($blockPlace);
$this->blockReplace = $blockReplace;
$this->blockAgainst = $blockAgainst;
$this->item = $item;
$this->player = $player;
}
/**