mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-17 17:04:08 +00:00
CommandEnum: specify enumValues type
phpstan 0.12.26 starts reporting errors about the result of array_search() being given to some constructor or another because of the lack of key type specification.
This commit is contained in:
parent
42613618a5
commit
fcc9e62c65
@ -172,6 +172,7 @@ use pocketmine\utils\TextFormat;
|
||||
use pocketmine\utils\UUID;
|
||||
use function abs;
|
||||
use function array_merge;
|
||||
use function array_values;
|
||||
use function assert;
|
||||
use function base64_decode;
|
||||
use function ceil;
|
||||
@ -742,7 +743,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
$data->aliases = new CommandEnum();
|
||||
$data->aliases->enumName = ucfirst($command->getName()) . "Aliases";
|
||||
$data->aliases->enumValues = $aliases;
|
||||
$data->aliases->enumValues = array_values($aliases);
|
||||
}
|
||||
|
||||
$pk->commandData[$command->getName()] = $data;
|
||||
|
@ -26,7 +26,10 @@ namespace pocketmine\network\mcpe\protocol\types;
|
||||
class CommandEnum{
|
||||
/** @var string */
|
||||
public $enumName;
|
||||
/** @var string[] */
|
||||
/**
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $enumValues = [];
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user