Skip to content

Commit

Permalink
phpdoc improvements for recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Jan 7, 2025
1 parent 30a89b6 commit 533b7c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/types/recipe/ShapedRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ final class ShapedRecipe extends RecipeWithTypeId{
/**
* @param RecipeIngredient[][] $input
* @param ItemStack[] $output
* @phpstan-param list<list<RecipeIngredient>> $input
* @phpstan-param list<ItemStack> $output
*/
public function __construct(
int $typeId,
Expand Down Expand Up @@ -68,13 +70,15 @@ public function getHeight() : int{

/**
* @return RecipeIngredient[][]
* @phpstan-return list<list<RecipeIngredient>>
*/
public function getInput() : array{
return $this->input;
}

/**
* @return ItemStack[]
* @phpstan-return list<ItemStack>
*/
public function getOutput() : array{
return $this->output;
Expand Down
4 changes: 4 additions & 0 deletions src/types/recipe/ShapelessRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ final class ShapelessRecipe extends RecipeWithTypeId{
/**
* @param RecipeIngredient[] $inputs
* @param ItemStack[] $outputs
* @phpstan-param list<RecipeIngredient> $inputs
* @phpstan-param list<ItemStack> $outputs
*/
public function __construct(
int $typeId,
Expand All @@ -44,13 +46,15 @@ public function getRecipeId() : string{

/**
* @return RecipeIngredient[]
* @phpstan-return list<RecipeIngredient>
*/
public function getInputs() : array{
return $this->inputs;
}

/**
* @return ItemStack[]
* @phpstan-return list<ItemStack>
*/
public function getOutputs() : array{
return $this->outputs;
Expand Down
6 changes: 6 additions & 0 deletions tests/phpstan/configs/phpstan-bugs.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ parameters:
identifier: expr.resultUnused
count: 1
path: ../../../src/types/command/CommandOverload.php

-
message: '#^Parameter \#3 \$input of class pocketmine\\network\\mcpe\\protocol\\types\\recipe\\ShapedRecipe constructor expects list\<list\<pocketmine\\network\\mcpe\\protocol\\types\\recipe\\RecipeIngredient\>\>, array\<int\<0, max\>, non\-empty\-array\<int\<0, max\>, pocketmine\\network\\mcpe\\protocol\\types\\recipe\\RecipeIngredient\>\> given\.$#'
identifier: argument.type
count: 1
path: ../../../src/types/recipe/ShapedRecipe.php

0 comments on commit 533b7c3

Please sign in to comment.