RegistryUtils: generate ordered doc comments

this makes things easier to find, especially in the large ones like VanillaBlocks.
This commit is contained in:
Dylan K. Taylor 2021-03-22 16:16:28 +00:00
parent 90161f24e3
commit 49438d360d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
16 changed files with 76 additions and 68 deletions

View File

@ -48,8 +48,8 @@ use function assert;
* @method static Wood ACACIA_WOOD()
* @method static ActivatorRail ACTIVATOR_RAIL()
* @method static Air AIR()
* @method static MushroomStem ALL_SIDED_MUSHROOM_STEM()
* @method static Flower ALLIUM()
* @method static MushroomStem ALL_SIDED_MUSHROOM_STEM()
* @method static Opaque ANDESITE()
* @method static Slab ANDESITE_SLAB()
* @method static Stair ANDESITE_STAIRS()
@ -94,10 +94,10 @@ use function assert;
* @method static BoneBlock BONE_BLOCK()
* @method static Bookshelf BOOKSHELF()
* @method static BrewingStand BREWING_STAND()
* @method static Opaque BRICKS()
* @method static Slab BRICK_SLAB()
* @method static Stair BRICK_STAIRS()
* @method static Wall BRICK_WALL()
* @method static Opaque BRICKS()
* @method static GlazedTerracotta BROWN_GLAZED_TERRACOTTA()
* @method static BrownMushroom BROWN_MUSHROOM()
* @method static BrownMushroomBlock BROWN_MUSHROOM_BLOCK()
@ -295,14 +295,14 @@ use function assert;
* @method static Opaque EMERALD()
* @method static EmeraldOre EMERALD_ORE()
* @method static EnchantingTable ENCHANTING_TABLE()
* @method static EnderChest ENDER_CHEST()
* @method static EndPortalFrame END_PORTAL_FRAME()
* @method static EndRod END_ROD()
* @method static Opaque END_STONE()
* @method static Opaque END_STONE_BRICKS()
* @method static Slab END_STONE_BRICK_SLAB()
* @method static Stair END_STONE_BRICK_STAIRS()
* @method static Wall END_STONE_BRICK_WALL()
* @method static Opaque END_STONE_BRICKS()
* @method static EnderChest ENDER_CHEST()
* @method static Slab FAKE_WOODEN_SLAB()
* @method static Farmland FARMLAND()
* @method static TallGrass FERN()
@ -440,23 +440,23 @@ use function assert;
* @method static Slab MOSSY_COBBLESTONE_SLAB()
* @method static Stair MOSSY_COBBLESTONE_STAIRS()
* @method static Wall MOSSY_COBBLESTONE_WALL()
* @method static Opaque MOSSY_STONE_BRICKS()
* @method static Slab MOSSY_STONE_BRICK_SLAB()
* @method static Stair MOSSY_STONE_BRICK_STAIRS()
* @method static Wall MOSSY_STONE_BRICK_WALL()
* @method static Opaque MOSSY_STONE_BRICKS()
* @method static MushroomStem MUSHROOM_STEM()
* @method static Mycelium MYCELIUM()
* @method static Netherrack NETHERRACK()
* @method static Opaque NETHER_BRICKS()
* @method static Fence NETHER_BRICK_FENCE()
* @method static Slab NETHER_BRICK_SLAB()
* @method static Stair NETHER_BRICK_STAIRS()
* @method static Wall NETHER_BRICK_WALL()
* @method static Opaque NETHER_BRICKS()
* @method static NetherPortal NETHER_PORTAL()
* @method static NetherQuartzOre NETHER_QUARTZ_ORE()
* @method static NetherReactor NETHER_REACTOR_CORE()
* @method static NetherWartPlant NETHER_WART()
* @method static Opaque NETHER_WART_BLOCK()
* @method static Netherrack NETHERRACK()
* @method static Note NOTE_BLOCK()
* @method static WoodenButton OAK_BUTTON()
* @method static WoodenDoor OAK_DOOR()
@ -523,13 +523,20 @@ use function assert;
* @method static Slab QUARTZ_SLAB()
* @method static Stair QUARTZ_STAIRS()
* @method static Rail RAIL()
* @method static Redstone REDSTONE()
* @method static RedstoneComparator REDSTONE_COMPARATOR()
* @method static RedstoneLamp REDSTONE_LAMP()
* @method static RedstoneOre REDSTONE_ORE()
* @method static RedstoneRepeater REDSTONE_REPEATER()
* @method static RedstoneTorch REDSTONE_TORCH()
* @method static RedstoneWire REDSTONE_WIRE()
* @method static GlazedTerracotta RED_GLAZED_TERRACOTTA()
* @method static RedMushroom RED_MUSHROOM()
* @method static RedMushroomBlock RED_MUSHROOM_BLOCK()
* @method static Opaque RED_NETHER_BRICKS()
* @method static Slab RED_NETHER_BRICK_SLAB()
* @method static Stair RED_NETHER_BRICK_STAIRS()
* @method static Wall RED_NETHER_BRICK_WALL()
* @method static Opaque RED_NETHER_BRICKS()
* @method static Sand RED_SAND()
* @method static Opaque RED_SANDSTONE()
* @method static Slab RED_SANDSTONE_SLAB()
@ -540,13 +547,6 @@ use function assert;
* @method static GlassPane RED_STAINED_GLASS_PANE()
* @method static Torch RED_TORCH()
* @method static Flower RED_TULIP()
* @method static Redstone REDSTONE()
* @method static RedstoneComparator REDSTONE_COMPARATOR()
* @method static RedstoneLamp REDSTONE_LAMP()
* @method static RedstoneOre REDSTONE_ORE()
* @method static RedstoneRepeater REDSTONE_REPEATER()
* @method static RedstoneTorch REDSTONE_TORCH()
* @method static RedstoneWire REDSTONE_WIRE()
* @method static Reserved6 RESERVED6()
* @method static DoublePlant ROSE_BUSH()
* @method static Sand SAND()
@ -587,10 +587,10 @@ use function assert;
* @method static WallSign SPRUCE_WALL_SIGN()
* @method static Wood SPRUCE_WOOD()
* @method static Opaque STONE()
* @method static Opaque STONE_BRICKS()
* @method static Slab STONE_BRICK_SLAB()
* @method static Stair STONE_BRICK_STAIRS()
* @method static Wall STONE_BRICK_WALL()
* @method static Opaque STONE_BRICKS()
* @method static StoneButton STONE_BUTTON()
* @method static StonePressurePlate STONE_PRESSURE_PLATE()
* @method static Slab STONE_SLAB()

View File

@ -30,11 +30,11 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static CoralType TUBE()
* @method static CoralType BRAIN()
* @method static CoralType BUBBLE()
* @method static CoralType FIRE()
* @method static CoralType HORN()
* @method static CoralType TUBE()
*/
final class CoralType{
use EnumTrait {

View File

@ -31,22 +31,22 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static DyeColor WHITE()
* @method static DyeColor ORANGE()
* @method static DyeColor MAGENTA()
* @method static DyeColor LIGHT_BLUE()
* @method static DyeColor YELLOW()
* @method static DyeColor LIME()
* @method static DyeColor PINK()
* @method static DyeColor GRAY()
* @method static DyeColor LIGHT_GRAY()
* @method static DyeColor CYAN()
* @method static DyeColor PURPLE()
* @method static DyeColor BLACK()
* @method static DyeColor BLUE()
* @method static DyeColor BROWN()
* @method static DyeColor CYAN()
* @method static DyeColor GRAY()
* @method static DyeColor GREEN()
* @method static DyeColor LIGHT_BLUE()
* @method static DyeColor LIGHT_GRAY()
* @method static DyeColor LIME()
* @method static DyeColor MAGENTA()
* @method static DyeColor ORANGE()
* @method static DyeColor PINK()
* @method static DyeColor PURPLE()
* @method static DyeColor RED()
* @method static DyeColor BLACK()
* @method static DyeColor WHITE()
* @method static DyeColor YELLOW()
*/
final class DyeColor{
use EnumTrait {

View File

@ -31,18 +31,18 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static RecordType DISK_11()
* @method static RecordType DISK_13()
* @method static RecordType DISK_CAT()
* @method static RecordType DISK_BLOCKS()
* @method static RecordType DISK_CAT()
* @method static RecordType DISK_CHIRP()
* @method static RecordType DISK_FAR()
* @method static RecordType DISK_MALL()
* @method static RecordType DISK_MELLOHI()
* @method static RecordType DISK_STAL()
* @method static RecordType DISK_STRAD()
* @method static RecordType DISK_WARD()
* @method static RecordType DISK_11()
* @method static RecordType DISK_WAIT()
* @method static RecordType DISK_WARD()
*/
final class RecordType{
use EnumTrait {

View File

@ -30,12 +30,12 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static SkullType CREEPER()
* @method static SkullType DRAGON()
* @method static SkullType PLAYER()
* @method static SkullType SKELETON()
* @method static SkullType WITHER_SKELETON()
* @method static SkullType ZOMBIE()
* @method static SkullType PLAYER()
* @method static SkullType CREEPER()
* @method static SkullType DRAGON()
*/
final class SkullType{
use EnumTrait {

View File

@ -31,8 +31,8 @@ use pocketmine\utils\EnumTrait;
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static SlabType BOTTOM()
* @method static SlabType TOP()
* @method static SlabType DOUBLE()
* @method static SlabType TOP()
*/
final class SlabType{
use EnumTrait;

View File

@ -30,11 +30,11 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static StairShape STRAIGHT()
* @method static StairShape INNER_LEFT()
* @method static StairShape INNER_RIGHT()
* @method static StairShape OUTER_LEFT()
* @method static StairShape OUTER_RIGHT()
* @method static StairShape STRAIGHT()
*/
final class StairShape{
use EnumTrait;

View File

@ -30,12 +30,12 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static TreeType ACACIA()
* @method static TreeType BIRCH()
* @method static TreeType DARK_OAK()
* @method static TreeType JUNGLE()
* @method static TreeType OAK()
* @method static TreeType SPRUCE()
* @method static TreeType BIRCH()
* @method static TreeType JUNGLE()
* @method static TreeType ACACIA()
* @method static TreeType DARK_OAK()
*/
final class TreeType{
use EnumTrait {

View File

@ -30,8 +30,8 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static ItemUseResult NONE()
* @method static ItemUseResult FAIL()
* @method static ItemUseResult NONE()
* @method static ItemUseResult SUCCESS()
*/
final class ItemUseResult{

View File

@ -30,11 +30,11 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static ToolTier WOOD()
* @method static ToolTier GOLD()
* @method static ToolTier STONE()
* @method static ToolTier IRON()
* @method static ToolTier DIAMOND()
* @method static ToolTier GOLD()
* @method static ToolTier IRON()
* @method static ToolTier STONE()
* @method static ToolTier WOOD()
*/
final class ToolTier{
use EnumTrait {

View File

@ -146,8 +146,6 @@ use function assert;
* @method static GlassBottle GLASS_BOTTLE()
* @method static Item GLISTERING_MELON()
* @method static Item GLOWSTONE_DUST()
* @method static Item GOLD_INGOT()
* @method static Item GOLD_NUGGET()
* @method static GoldenApple GOLDEN_APPLE()
* @method static Axe GOLDEN_AXE()
* @method static Armor GOLDEN_BOOTS()
@ -159,6 +157,8 @@ use function assert;
* @method static Pickaxe GOLDEN_PICKAXE()
* @method static Shovel GOLDEN_SHOVEL()
* @method static Sword GOLDEN_SWORD()
* @method static Item GOLD_INGOT()
* @method static Item GOLD_NUGGET()
* @method static Bed GRAY_BED()
* @method static Dye GRAY_DYE()
* @method static Bed GREEN_BED()
@ -245,9 +245,9 @@ use function assert;
* @method static Record RECORD_STRAD()
* @method static Record RECORD_WAIT()
* @method static Record RECORD_WARD()
* @method static Redstone REDSTONE_DUST()
* @method static Bed RED_BED()
* @method static Dye RED_DYE()
* @method static Redstone REDSTONE_DUST()
* @method static RottenFlesh ROTTEN_FLESH()
* @method static Item SCUTE()
* @method static Shears SHEARS()

View File

@ -31,24 +31,24 @@ use pocketmine\utils\RegistryTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static ProtectionEnchantment PROTECTION()
* @method static ProtectionEnchantment FIRE_PROTECTION()
* @method static ProtectionEnchantment FEATHER_FALLING()
* @method static ProtectionEnchantment BLAST_PROTECTION()
* @method static ProtectionEnchantment PROJECTILE_PROTECTION()
* @method static Enchantment THORNS()
* @method static Enchantment RESPIRATION()
* @method static SharpnessEnchantment SHARPNESS()
* @method static KnockbackEnchantment KNOCKBACK()
* @method static FireAspectEnchantment FIRE_ASPECT()
* @method static Enchantment EFFICIENCY()
* @method static Enchantment SILK_TOUCH()
* @method static Enchantment UNBREAKING()
* @method static Enchantment POWER()
* @method static Enchantment PUNCH()
* @method static ProtectionEnchantment FEATHER_FALLING()
* @method static FireAspectEnchantment FIRE_ASPECT()
* @method static ProtectionEnchantment FIRE_PROTECTION()
* @method static Enchantment FLAME()
* @method static Enchantment INFINITY()
* @method static KnockbackEnchantment KNOCKBACK()
* @method static Enchantment MENDING()
* @method static Enchantment POWER()
* @method static ProtectionEnchantment PROJECTILE_PROTECTION()
* @method static ProtectionEnchantment PROTECTION()
* @method static Enchantment PUNCH()
* @method static Enchantment RESPIRATION()
* @method static SharpnessEnchantment SHARPNESS()
* @method static Enchantment SILK_TOUCH()
* @method static Enchantment THORNS()
* @method static Enchantment UNBREAKING()
* @method static Enchantment VANISHING()
*/
final class VanillaEnchantments{

View File

@ -30,10 +30,10 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static GameMode SURVIVAL()
* @method static GameMode CREATIVE()
* @method static GameMode ADVENTURE()
* @method static GameMode CREATIVE()
* @method static GameMode SPECTATOR()
* @method static GameMode SURVIVAL()
*/
final class GameMode{
use EnumTrait {

View File

@ -30,8 +30,8 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static PluginEnableOrder STARTUP()
* @method static PluginEnableOrder POSTWORLD()
* @method static PluginEnableOrder STARTUP()
*/
final class PluginEnableOrder{
use EnumTrait;

View File

@ -27,6 +27,7 @@ use function get_class;
use function implode;
use function mb_strtoupper;
use function sprintf;
use const SORT_STRING;
final class RegistryUtils{
@ -63,6 +64,7 @@ public static function %1$s() : %2$s{
$lines[] = " *";
static $lineTmpl = " * @method static %2\$s %s()";
$memberLines = [];
foreach($members as $name => $member){
$reflect = new \ReflectionClass($member);
while($reflect !== false and $reflect->isAnonymous()){
@ -75,7 +77,13 @@ public static function %1$s() : %2$s{
}else{
$typehint = '\\' . $reflect->getName();
}
$lines[] = sprintf($lineTmpl, mb_strtoupper($name), $typehint);
$accessor = mb_strtoupper($name);
$memberLines[$accessor] = sprintf($lineTmpl, $accessor, $typehint);
}
ksort($memberLines, SORT_STRING);
foreach($memberLines as $line){
$lines[] = $line;
}
$lines[] = " */";
return implode("\n", $lines);

View File

@ -30,11 +30,11 @@ use pocketmine\utils\EnumTrait;
* This must be regenerated whenever registry members are added, removed or changed.
* @see \pocketmine\utils\RegistryUtils::_generateMethodAnnotations()
*
* @method static NoteInstrument PIANO()
* @method static NoteInstrument BASS_DRUM()
* @method static NoteInstrument SNARE()
* @method static NoteInstrument CLICKS_AND_STICKS()
* @method static NoteInstrument DOUBLE_BASS()
* @method static NoteInstrument PIANO()
* @method static NoteInstrument SNARE()
*/
final class NoteInstrument{
use EnumTrait {