mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added documentation for RegistryTrait, EnumTrait and CloningRegistryTrait
This commit is contained in:
parent
279056fe2f
commit
eb62dc3294
@ -23,6 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\utils;
|
||||
|
||||
/**
|
||||
* This trait offers the same functionality as RegistryTrait, but also clones any returned objects to prevent outside
|
||||
* modification.
|
||||
*/
|
||||
trait CloningRegistryTrait{
|
||||
use RegistryTrait;
|
||||
|
||||
|
@ -23,6 +23,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\utils;
|
||||
|
||||
/**
|
||||
* This trait allows a class to simulate a Java-style enum. Members are exposed as static methods and handled via
|
||||
* __callStatic().
|
||||
*
|
||||
* Classes using this trait need to include \@method tags in their class docblock for every enum member.
|
||||
* Alternatively, just put \@generate-registry-docblock in the docblock and run tools/generate-registry-annotations.php
|
||||
*/
|
||||
trait EnumTrait{
|
||||
use RegistryTrait;
|
||||
use NotCloneable;
|
||||
|
@ -28,6 +28,13 @@ use function count;
|
||||
use function mb_strtoupper;
|
||||
use function preg_match;
|
||||
|
||||
/**
|
||||
* This trait allows a class to simulate object class constants, since PHP doesn't currently support this.
|
||||
* These faux constants are exposed in static class methods, which are handled using __callStatic().
|
||||
*
|
||||
* Classes using this trait need to include \@method tags in their class docblock for every faux constant.
|
||||
* Alternatively, just put \@generate-registry-docblock in the docblock and run tools/generate-registry-annotations.php
|
||||
*/
|
||||
trait RegistryTrait{
|
||||
/**
|
||||
* @var object[]
|
||||
|
Loading…
x
Reference in New Issue
Block a user