Promote some constructors

This commit is contained in:
Dylan K. Taylor
2022-05-17 22:34:58 +01:00
parent 8e767da29e
commit d4b7f66e15
30 changed files with 144 additions and 218 deletions

View File

@ -31,13 +31,12 @@ use function count;
* An inventory which is backed by another inventory, and acts as a proxy to that inventory.
*/
class DelegateInventory extends BaseInventory{
private Inventory $backingInventory;
private InventoryListener $inventoryListener;
public function __construct(Inventory $backingInventory){
public function __construct(
private Inventory $backingInventory
){
parent::__construct();
$this->backingInventory = $backingInventory;
$this->backingInventory->getListeners()->add($this->inventoryListener = new CallbackInventoryListener(
function(Inventory $unused, int $slot, Item $oldItem) : void{
$this->onSlotChange($slot, $oldItem);

View File

@ -26,11 +26,10 @@ namespace pocketmine\inventory;
use pocketmine\entity\Human;
final class PlayerEnderInventory extends SimpleInventory{
private Human $holder;
public function __construct(Human $holder, int $size = 27){
$this->holder = $holder;
public function __construct(
private Human $holder,
int $size = 27
){
parent::__construct($size);
}