Generate parameter name

This commit is contained in:
Dylan K. Taylor 2025-02-17 01:56:13 +00:00
parent 799dfecdd9
commit f4f31b654b
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 10 additions and 8 deletions

View File

@ -35,6 +35,7 @@ use function fwrite;
use function implode;
use function is_dir;
use function ksort;
use function lcfirst;
use function mb_strtoupper;
use function preg_match;
use function sprintf;
@ -84,9 +85,10 @@ function generateMethodAnnotations(string $namespaceName, array $members, array
foreach(Utils::stringifyKeys($overloadedMembers) as $baseName => $member){
$accessor = mb_strtoupper($baseName);
$returnTypehint = makeTypehint($namespaceName, new \ReflectionClass($member->memberClass));
$paramTypehint = makeTypehint($namespaceName, new \ReflectionClass($member->enumClass));
$enumReflect = new \ReflectionClass($member->enumClass);
$paramTypehint = makeTypehint($namespaceName, $enumReflect);
$memberLines[] = sprintf(" * @method static %s %s(%s)", $returnTypehint, $accessor, $paramTypehint);
$memberLines[] = sprintf(" * @method static %s %s(%s \$%s)", $returnTypehint, $accessor, $paramTypehint, lcfirst($enumReflect->getShortName()));
}
ksort($memberLines, SORT_STRING);

View File

@ -79,10 +79,10 @@ use function strtolower;
* @see build/generate-registry-annotations.php
* @generate-registry-docblock
*
* @method static Sapling SAPLING(\pocketmine\block\utils\SaplingType)
* @method static Leaves LEAVES(\pocketmine\block\utils\LeavesType)
* @method static FloorSign SIGN(\pocketmine\block\utils\WoodType)
* @method static WallSign WALL_SIGN(\pocketmine\block\utils\WoodType)
* @method static Sapling SAPLING(\pocketmine\block\utils\SaplingType $saplingType)
* @method static Leaves LEAVES(\pocketmine\block\utils\LeavesType $leavesType)
* @method static FloorSign SIGN(\pocketmine\block\utils\WoodType $woodType)
* @method static WallSign WALL_SIGN(\pocketmine\block\utils\WoodType $woodType)
* @method static WoodenButton ACACIA_BUTTON()
* @method static WoodenDoor ACACIA_DOOR()
* @method static WoodenFence ACACIA_FENCE()

View File

@ -48,8 +48,8 @@ use function strtolower;
* @see build/generate-registry-annotations.php
* @generate-registry-docblock
*
* @method static Boat BOAT(BoatType)
* @method static ItemBlockWallOrFloor SIGN(\pocketmine\block\utils\WoodType)
* @method static Boat BOAT(BoatType $boatType)
* @method static ItemBlockWallOrFloor SIGN(\pocketmine\block\utils\WoodType $woodType)
* @method static Boat ACACIA_BOAT()
* @method static ItemBlockWallOrFloor ACACIA_SIGN()
* @method static ItemBlock AIR()