Modernize property declarations in pocketmine\crafting namespace

This commit is contained in:
Dylan K. Taylor 2022-04-25 13:15:48 +01:00
parent dca457b1e0
commit b402df8b91
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
6 changed files with 22 additions and 38 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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.

View File

@ -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.