mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Modernize property declarations in pocketmine\crafting namespace
This commit is contained in:
parent
dca457b1e0
commit
b402df8b91
@ -33,17 +33,12 @@ abstract class CraftingGrid extends SimpleInventory{
|
||||
public const SIZE_SMALL = 2;
|
||||
public const SIZE_BIG = 3;
|
||||
|
||||
/** @var int */
|
||||
private $gridWidth;
|
||||
private int $gridWidth;
|
||||
|
||||
/** @var int|null */
|
||||
private $startX;
|
||||
/** @var int|null */
|
||||
private $xLen;
|
||||
/** @var int|null */
|
||||
private $startY;
|
||||
/** @var int|null */
|
||||
private $yLen;
|
||||
private ?int $startX = null;
|
||||
private ?int $xLen = null;
|
||||
private ?int $startY = null;
|
||||
private ?int $yLen = null;
|
||||
|
||||
public function __construct(int $gridWidth){
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
@ -57,11 +57,8 @@ class CraftingManager{
|
||||
*/
|
||||
protected $potionContainerChangeRecipes = [];
|
||||
|
||||
/**
|
||||
* @var ObjectSet
|
||||
* @phpstan-var ObjectSet<\Closure() : void>
|
||||
*/
|
||||
private $recipeRegisteredCallbacks;
|
||||
/** @phpstan-var ObjectSet<\Closure() : void> */
|
||||
private ObjectSet $recipeRegisteredCallbacks;
|
||||
|
||||
public function __construct(){
|
||||
$this->recipeRegisteredCallbacks = new ObjectSet();
|
||||
|
@ -27,14 +27,11 @@ use pocketmine\item\Item;
|
||||
|
||||
class FurnaceRecipe{
|
||||
|
||||
/** @var Item */
|
||||
private $output;
|
||||
|
||||
/** @var Item */
|
||||
private $ingredient;
|
||||
|
||||
public function __construct(Item $result, Item $ingredient){
|
||||
$this->output = clone $result;
|
||||
public function __construct(
|
||||
private Item $result,
|
||||
private Item $ingredient
|
||||
){
|
||||
$this->result = clone $result;
|
||||
$this->ingredient = clone $ingredient;
|
||||
}
|
||||
|
||||
@ -43,6 +40,6 @@ class FurnaceRecipe{
|
||||
}
|
||||
|
||||
public function getResult() : Item{
|
||||
return clone $this->output;
|
||||
return clone $this->result;
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,8 @@ final class FurnaceRecipeManager{
|
||||
/** @var FurnaceRecipe[] */
|
||||
protected $furnaceRecipes = [];
|
||||
|
||||
/**
|
||||
* @var ObjectSet
|
||||
* @phpstan-var ObjectSet<\Closure(FurnaceRecipe) : void>
|
||||
*/
|
||||
private $recipeRegisteredCallbacks;
|
||||
/** @phpstan-var ObjectSet<\Closure(FurnaceRecipe) : void> */
|
||||
private ObjectSet $recipeRegisteredCallbacks;
|
||||
|
||||
public function __construct(){
|
||||
$this->recipeRegisteredCallbacks = new ObjectSet();
|
||||
|
@ -34,16 +34,14 @@ use function strpos;
|
||||
|
||||
class ShapedRecipe implements CraftingRecipe{
|
||||
/** @var string[] */
|
||||
private $shape = [];
|
||||
private array $shape = [];
|
||||
/** @var Item[] char => Item map */
|
||||
private $ingredientList = [];
|
||||
private array $ingredientList = [];
|
||||
/** @var Item[] */
|
||||
private $results = [];
|
||||
private array $results = [];
|
||||
|
||||
/** @var int */
|
||||
private $height;
|
||||
/** @var int */
|
||||
private $width;
|
||||
private int $height;
|
||||
private int $width;
|
||||
|
||||
/**
|
||||
* Constructs a ShapedRecipe instance.
|
||||
|
@ -29,9 +29,9 @@ use function count;
|
||||
|
||||
class ShapelessRecipe implements CraftingRecipe{
|
||||
/** @var Item[] */
|
||||
private $ingredients = [];
|
||||
private array $ingredients = [];
|
||||
/** @var Item[] */
|
||||
private $results;
|
||||
private array $results;
|
||||
|
||||
/**
|
||||
* @param Item[] $ingredients No more than 9 total. This applies to sum of item stack counts, not count of array.
|
||||
|
Loading…
x
Reference in New Issue
Block a user