mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Modernize private property declarations in src/permission
This commit is contained in:
parent
6eac2ea7a5
commit
22edca610c
@ -36,16 +36,11 @@ class BanEntry{
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public static $format = "Y-m-d H:i:s O";
|
public static $format = "Y-m-d H:i:s O";
|
||||||
|
|
||||||
/** @var string */
|
private string $name;
|
||||||
private $name;
|
private \DateTime $creationDate;
|
||||||
/** @var \DateTime */
|
private string $source = "(Unknown)";
|
||||||
private $creationDate;
|
private ?\DateTime $expirationDate = null;
|
||||||
/** @var string */
|
private string $reason = "Banned by an operator.";
|
||||||
private $source = "(Unknown)";
|
|
||||||
/** @var \DateTime|null */
|
|
||||||
private $expirationDate = null;
|
|
||||||
/** @var string */
|
|
||||||
private $reason = "Banned by an operator.";
|
|
||||||
|
|
||||||
public function __construct(string $name){
|
public function __construct(string $name){
|
||||||
$this->name = strtolower($name);
|
$this->name = strtolower($name);
|
||||||
|
@ -32,19 +32,14 @@ use function strtolower;
|
|||||||
use function trim;
|
use function trim;
|
||||||
|
|
||||||
class BanList{
|
class BanList{
|
||||||
|
|
||||||
/** @var BanEntry[] */
|
/** @var BanEntry[] */
|
||||||
private $list = [];
|
private array $list = [];
|
||||||
|
|
||||||
/** @var string */
|
private bool $enabled = true;
|
||||||
private $file;
|
|
||||||
|
|
||||||
/** @var bool */
|
public function __construct(
|
||||||
private $enabled = true;
|
private string $file
|
||||||
|
){}
|
||||||
public function __construct(string $file){
|
|
||||||
$this->file = $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isEnabled() : bool{
|
public function isEnabled() : bool{
|
||||||
return $this->enabled;
|
return $this->enabled;
|
||||||
|
@ -44,19 +44,19 @@ class PermissibleInternal implements Permissible{
|
|||||||
* @var bool[]
|
* @var bool[]
|
||||||
* @phpstan-var array<string, bool>
|
* @phpstan-var array<string, bool>
|
||||||
*/
|
*/
|
||||||
private $rootPermissions;
|
private array $rootPermissions;
|
||||||
|
|
||||||
/** @var PermissionAttachment[] */
|
/** @var PermissionAttachment[] */
|
||||||
private $attachments = [];
|
private array $attachments = [];
|
||||||
|
|
||||||
/** @var PermissionAttachmentInfo[] */
|
/** @var PermissionAttachmentInfo[] */
|
||||||
private $permissions = [];
|
private array $permissions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectSet|\Closure[]
|
* @var ObjectSet|\Closure[]
|
||||||
* @phpstan-var ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
|
* @phpstan-var ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
|
||||||
*/
|
*/
|
||||||
private $permissionRecalculationCallbacks;
|
private ObjectSet $permissionRecalculationCallbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool[] $basePermissions
|
* @param bool[] $basePermissions
|
||||||
|
@ -31,17 +31,7 @@ namespace pocketmine\permission;
|
|||||||
* Represents a permission
|
* Represents a permission
|
||||||
*/
|
*/
|
||||||
class Permission{
|
class Permission{
|
||||||
/** @var string */
|
private string $description;
|
||||||
private $name;
|
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
private $description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool[]
|
|
||||||
* @phpstan-var array<string, bool>
|
|
||||||
*/
|
|
||||||
private $children;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Permission object to be attached to Permissible objects
|
* Creates a new Permission object to be attached to Permissible objects
|
||||||
@ -49,10 +39,12 @@ class Permission{
|
|||||||
* @param bool[] $children
|
* @param bool[] $children
|
||||||
* @phpstan-param array<string, bool> $children
|
* @phpstan-param array<string, bool> $children
|
||||||
*/
|
*/
|
||||||
public function __construct(string $name, ?string $description = null, array $children = []){
|
public function __construct(
|
||||||
$this->name = $name;
|
private string $name,
|
||||||
$this->description = $description ?? "";
|
?string $description = null,
|
||||||
$this->children = $children;
|
private array $children = []
|
||||||
|
){
|
||||||
|
$this->description = $description ?? ""; //TODO: wtf ????
|
||||||
|
|
||||||
$this->recalculatePermissibles();
|
$this->recalculatePermissibles();
|
||||||
}
|
}
|
||||||
|
@ -29,26 +29,23 @@ use function spl_object_id;
|
|||||||
|
|
||||||
class PermissionAttachment{
|
class PermissionAttachment{
|
||||||
/** @var bool[] */
|
/** @var bool[] */
|
||||||
private $permissions = [];
|
private array $permissions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PermissibleInternal[]
|
* @var PermissibleInternal[]
|
||||||
* @phpstan-var array<int, PermissibleInternal>
|
* @phpstan-var array<int, PermissibleInternal>
|
||||||
*/
|
*/
|
||||||
private $subscribers = [];
|
private array $subscribers = [];
|
||||||
|
|
||||||
/** @var Plugin */
|
|
||||||
private $plugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws PluginException
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
public function __construct(Plugin $plugin){
|
public function __construct(
|
||||||
|
private Plugin $plugin
|
||||||
|
){
|
||||||
if(!$plugin->isEnabled()){
|
if(!$plugin->isEnabled()){
|
||||||
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
|
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->plugin = $plugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlugin() : Plugin{
|
public function getPlugin() : Plugin{
|
||||||
|
@ -24,24 +24,12 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\permission;
|
namespace pocketmine\permission;
|
||||||
|
|
||||||
class PermissionAttachmentInfo{
|
class PermissionAttachmentInfo{
|
||||||
/** @var string */
|
public function __construct(
|
||||||
private $permission;
|
private string $permission,
|
||||||
|
private ?PermissionAttachment $attachment,
|
||||||
/** @var PermissionAttachment|null */
|
private bool $value,
|
||||||
private $attachment;
|
private ?PermissionAttachmentInfo $groupPermission
|
||||||
|
){}
|
||||||
/** @var bool */
|
|
||||||
private $value;
|
|
||||||
|
|
||||||
/** @var PermissionAttachmentInfo|null */
|
|
||||||
private $groupPermission;
|
|
||||||
|
|
||||||
public function __construct(string $permission, ?PermissionAttachment $attachment, bool $value, ?PermissionAttachmentInfo $groupPermission){
|
|
||||||
$this->permission = $permission;
|
|
||||||
$this->attachment = $attachment;
|
|
||||||
$this->value = $value;
|
|
||||||
$this->groupPermission = $groupPermission;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPermission() : string{
|
public function getPermission() : string{
|
||||||
return $this->permission;
|
return $this->permission;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user