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