phpdoc armageddon for master, pass 1

This commit is contained in:
Dylan K. Taylor
2020-01-22 11:55:03 +00:00
parent 4bae3baa74
commit 67bcc1c0fb
397 changed files with 0 additions and 5391 deletions

View File

@@ -63,8 +63,6 @@ class BanEntry{
}
/**
* @param \DateTime $date
*
* @throws \InvalidArgumentException
*/
public function setCreated(\DateTime $date) : void{
@@ -80,15 +78,11 @@ class BanEntry{
$this->source = $source;
}
/**
* @return \DateTime|null
*/
public function getExpires() : ?\DateTime{
return $this->expirationDate;
}
/**
* @param \DateTime|null $date
* @throws \InvalidArgumentException
*/
public function setExpires(?\DateTime $date) : void{
@@ -134,8 +128,6 @@ class BanEntry{
*
* @link https://bugs.php.net/bug.php?id=75992
*
* @param \DateTime $dateTime
*
* @throws \InvalidArgumentException if the argument can't be parsed from a formatted date string
*/
private static function validateDate(\DateTime $dateTime) : void{
@@ -147,9 +139,6 @@ class BanEntry{
}
/**
* @param string $date
*
* @return \DateTime
* @throws \RuntimeException
*/
private static function parseDate(string $date) : \DateTime{
@@ -162,9 +151,6 @@ class BanEntry{
}
/**
* @param string $str
*
* @return BanEntry|null
* @throws \RuntimeException
*/
public static function fromString(string $str) : ?BanEntry{

View File

@@ -42,32 +42,18 @@ class BanList{
/** @var bool */
private $enabled = true;
/**
* @param string $file
*/
public function __construct(string $file){
$this->file = $file;
}
/**
* @return bool
*/
public function isEnabled() : bool{
return $this->enabled;
}
/**
* @param bool $flag
*/
public function setEnabled(bool $flag) : void{
$this->enabled = $flag;
}
/**
* @param string $name
*
* @return BanEntry|null
*/
public function getEntry(string $name) : ?BanEntry{
$this->removeExpired();
@@ -83,11 +69,6 @@ class BanList{
return $this->list;
}
/**
* @param string $name
*
* @return bool
*/
public function isBanned(string $name) : bool{
$name = strtolower($name);
if(!$this->isEnabled()){
@@ -99,21 +80,15 @@ class BanList{
}
}
/**
* @param BanEntry $entry
*/
public function add(BanEntry $entry) : void{
$this->list[$entry->getName()] = $entry;
$this->save();
}
/**
* @param string $target
* @param string $reason
* @param \DateTime $expires
* @param string $source
*
* @return BanEntry
*/
public function addBan(string $target, ?string $reason = null, ?\DateTime $expires = null, ?string $source = null) : BanEntry{
$entry = new BanEntry($target);
@@ -127,9 +102,6 @@ class BanList{
return $entry;
}
/**
* @param string $name
*/
public function remove(string $name) : void{
$name = strtolower($name);
if(isset($this->list[$name])){
@@ -170,9 +142,6 @@ class BanList{
}
}
/**
* @param bool $writeHeader
*/
public function save(bool $writeHeader = true) : void{
$this->removeExpired();
$fp = @fopen($this->file, "w");

View File

@@ -27,10 +27,7 @@ abstract class DefaultPermissions{
public const ROOT = "pocketmine";
/**
* @param Permission $perm
* @param Permission $parent
*
* @return Permission
*/
public static function registerPermission(Permission $perm, ?Permission $parent = null) : Permission{
if($parent instanceof Permission){

View File

@@ -31,8 +31,6 @@ interface Permissible extends ServerOperator{
* Checks if this instance has a permission overridden
*
* @param string|Permission $name
*
* @return bool
*/
public function isPermissionSet($name) : bool;
@@ -40,31 +38,17 @@ interface Permissible extends ServerOperator{
* Returns the permission value if overridden, or the default value if not
*
* @param string|Permission $name
*
* @return bool
*/
public function hasPermission($name) : bool;
/**
* @param Plugin $plugin
* @param string $name
* @param bool $value
*
* @return PermissionAttachment
*/
public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment;
/**
* @param PermissionAttachment $attachment
*
* @return void
*/
public function removeAttachment(PermissionAttachment $attachment) : void;
/**
* @return void
*/
public function recalculatePermissions() : void;
/**

View File

@@ -45,9 +45,6 @@ class PermissibleBase implements Permissible{
*/
private $permissions = [];
/**
* @param ServerOperator $opable
*/
public function __construct(ServerOperator $opable){
$this->opable = $opable;
if($opable instanceof Permissible){
@@ -55,24 +52,16 @@ class PermissibleBase implements Permissible{
}
}
/**
* @return bool
*/
public function isOp() : bool{
return $this->opable->isOp();
}
/**
* @param bool $value
*/
public function setOp(bool $value) : void{
$this->opable->setOp($value);
}
/**
* @param Permission|string $name
*
* @return bool
*/
public function isPermissionSet($name) : bool{
return isset($this->permissions[$name instanceof Permission ? $name->getName() : $name]);
@@ -80,8 +69,6 @@ class PermissibleBase implements Permissible{
/**
* @param Permission|string $name
*
* @return bool
*/
public function hasPermission($name) : bool{
if($name instanceof Permission){
@@ -105,11 +92,8 @@ class PermissibleBase implements Permissible{
/**
* //TODO: tick scheduled attachments
*
* @param Plugin $plugin
* @param string $name
* @param bool $value
*
* @return PermissionAttachment
*/
public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{
if(!$plugin->isEnabled()){
@@ -127,9 +111,6 @@ class PermissibleBase implements Permissible{
return $result;
}
/**
* @param PermissionAttachment $attachment
*/
public function removeAttachment(PermissionAttachment $attachment) : void{
if(isset($this->attachments[spl_object_id($attachment)])){
unset($this->attachments[spl_object_id($attachment)]);
@@ -177,8 +158,6 @@ class PermissibleBase implements Permissible{
/**
* @param bool[] $children
* @param bool $invert
* @param PermissionAttachment|null $attachment
*/
private function calculateChildPermissions(array $children, bool $invert, ?PermissionAttachment $attachment) : void{
$permManager = PermissionManager::getInstance();

View File

@@ -30,11 +30,8 @@ trait PermissibleDelegateTrait{
/** @var PermissibleBase */
private $perm = null;
/**
* @param Permission|string $name
*
* @return bool
*/
public function isPermissionSet($name) : bool{
return $this->perm->isPermissionSet($name);
@@ -42,27 +39,19 @@ trait PermissibleDelegateTrait{
/**
* @param Permission|string $name
*
* @return bool
*/
public function hasPermission($name) : bool{
return $this->perm->hasPermission($name);
}
/**
* @param Plugin $plugin
* @param string $name
* @param bool $value
*
* @return PermissionAttachment
*/
public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{
return $this->perm->addAttachment($plugin, $name, $value);
}
/**
* @param PermissionAttachment $attachment
*/
public function removeAttachment(PermissionAttachment $attachment) : void{
$this->perm->removeAttachment($attachment);
}

View File

@@ -56,7 +56,6 @@ class Permission{
/**
* Creates a new Permission object to be attached to Permissible objects
*
* @param string $name
* @param string $description
* @param string $defaultValue
* @param bool[] $children
@@ -70,9 +69,6 @@ class Permission{
$this->recalculatePermissibles();
}
/**
* @return string
*/
public function getName() : string{
return $this->name;
}
@@ -84,16 +80,10 @@ class Permission{
return $this->children;
}
/**
* @return string
*/
public function getDefault() : string{
return $this->defaultValue;
}
/**
* @param string $value
*/
public function setDefault(string $value) : void{
if($value !== $this->defaultValue){
$this->defaultValue = $value;
@@ -101,16 +91,10 @@ class Permission{
}
}
/**
* @return string
*/
public function getDescription() : string{
return $this->description;
}
/**
* @param string $value
*/
public function setDescription(string $value) : void{
$this->description = $value;
}
@@ -132,10 +116,8 @@ class Permission{
}
}
/**
* @param string|Permission $name
* @param bool $value
*
* @return Permission|null Permission if $name is a string, null if it's a Permission
*/

View File

@@ -42,9 +42,6 @@ class PermissionAttachment{
private $plugin;
/**
* @param Plugin $plugin
* @param Permissible $permissible
*
* @throws PluginException
*/
public function __construct(Plugin $plugin, Permissible $permissible){
@@ -56,30 +53,18 @@ class PermissionAttachment{
$this->plugin = $plugin;
}
/**
* @return Plugin
*/
public function getPlugin() : Plugin{
return $this->plugin;
}
/**
* @param PermissionRemovedExecutor $ex
*/
public function setRemovalCallback(PermissionRemovedExecutor $ex) : void{
$this->removed = $ex;
}
/**
* @return PermissionRemovedExecutor|null
*/
public function getRemovalCallback() : ?PermissionRemovedExecutor{
return $this->removed;
}
/**
* @return Permissible
*/
public function getPermissible() : Permissible{
return $this->permissible;
}
@@ -118,7 +103,6 @@ class PermissionAttachment{
/**
* @param string|Permission $name
* @param bool $value
*/
public function setPermission($name, bool $value) : void{
$name = $name instanceof Permission ? $name->getName() : $name;
@@ -143,9 +127,6 @@ class PermissionAttachment{
}
}
/**
* @return void
*/
public function remove() : void{
$this->permissible->removeAttachment($this);
}

View File

@@ -38,11 +38,6 @@ class PermissionAttachmentInfo{
private $value;
/**
* @param Permissible $permissible
* @param string $permission
* @param PermissionAttachment|null $attachment
* @param bool $value
*
* @throws \InvalidStateException
*/
public function __construct(Permissible $permissible, string $permission, ?PermissionAttachment $attachment, bool $value){
@@ -52,30 +47,18 @@ class PermissionAttachmentInfo{
$this->value = $value;
}
/**
* @return Permissible
*/
public function getPermissible() : Permissible{
return $this->permissible;
}
/**
* @return string
*/
public function getPermission() : string{
return $this->permission;
}
/**
* @return PermissionAttachment|null
*/
public function getAttachment() : ?PermissionAttachment{
return $this->attachment;
}
/**
* @return bool
*/
public function getValue() : bool{
return $this->value;
}

View File

@@ -52,20 +52,10 @@ class PermissionManager{
/** @var Permissible[] */
protected $defSubsOp = [];
/**
* @param string $name
*
* @return null|Permission
*/
public function getPermission(string $name) : ?Permission{
return $this->permissions[$name] ?? null;
}
/**
* @param Permission $permission
*
* @return bool
*/
public function addPermission(Permission $permission) : bool{
if(!isset($this->permissions[$permission->getName()])){
$this->permissions[$permission->getName()] = $permission;
@@ -89,8 +79,6 @@ class PermissionManager{
}
/**
* @param bool $op
*
* @return Permission[]
*/
public function getDefaultPermissions(bool $op) : array{
@@ -101,9 +89,6 @@ class PermissionManager{
}
}
/**
* @param Permission $permission
*/
public function recalculatePermissionDefaults(Permission $permission) : void{
if(isset($this->permissions[$permission->getName()])){
unset($this->defaultPermsOp[$permission->getName()]);
@@ -112,9 +97,6 @@ class PermissionManager{
}
}
/**
* @param Permission $permission
*/
private function calculatePermissionDefault(Permission $permission) : void{
Timings::$permissionDefaultTimer->startTiming();
if($permission->getDefault() === Permission::DEFAULT_OP or $permission->getDefault() === Permission::DEFAULT_TRUE){
@@ -129,19 +111,12 @@ class PermissionManager{
Timings::$permissionDefaultTimer->startTiming();
}
/**
* @param bool $op
*/
private function dirtyPermissibles(bool $op) : void{
foreach($this->getDefaultPermSubscriptions($op) as $p){
$p->recalculatePermissions();
}
}
/**
* @param string $permission
* @param Permissible $permissible
*/
public function subscribeToPermission(string $permission, Permissible $permissible) : void{
if(!isset($this->permSubs[$permission])){
$this->permSubs[$permission] = [];
@@ -149,10 +124,6 @@ class PermissionManager{
$this->permSubs[$permission][spl_object_id($permissible)] = $permissible;
}
/**
* @param string $permission
* @param Permissible $permissible
*/
public function unsubscribeFromPermission(string $permission, Permissible $permissible) : void{
if(isset($this->permSubs[$permission])){
unset($this->permSubs[$permission][spl_object_id($permissible)]);
@@ -162,9 +133,6 @@ class PermissionManager{
}
}
/**
* @param Permissible $permissible
*/
public function unsubscribeFromAllPermissions(Permissible $permissible) : void{
foreach($this->permSubs as $permission => &$subs){
unset($subs[spl_object_id($permissible)]);
@@ -175,18 +143,12 @@ class PermissionManager{
}
/**
* @param string $permission
*
* @return array|Permissible[]
*/
public function getPermissionSubscriptions(string $permission) : array{
return $this->permSubs[$permission] ?? [];
}
/**
* @param bool $op
* @param Permissible $permissible
*/
public function subscribeToDefaultPerms(bool $op, Permissible $permissible) : void{
if($op){
$this->defSubsOp[spl_object_id($permissible)] = $permissible;
@@ -195,10 +157,6 @@ class PermissionManager{
}
}
/**
* @param bool $op
* @param Permissible $permissible
*/
public function unsubscribeFromDefaultPerms(bool $op, Permissible $permissible) : void{
if($op){
unset($this->defSubsOp[spl_object_id($permissible)]);
@@ -208,8 +166,6 @@ class PermissionManager{
}
/**
* @param bool $op
*
* @return Permissible[]
*/
public function getDefaultPermSubscriptions(bool $op) : array{

View File

@@ -33,8 +33,6 @@ class PermissionParser{
/**
* @param bool|string $value
*
* @return string
*
* @throws \InvalidArgumentException
*/
public static function defaultFromString($value) : string{
@@ -72,9 +70,6 @@ class PermissionParser{
}
/**
* @param array $data
* @param string $default
*
* @return Permission[]
*/
public static function loadPermissions(array $data, string $default = Permission::DEFAULT_OP) : array{
@@ -87,13 +82,6 @@ class PermissionParser{
}
/**
* @param string $name
* @param array $data
* @param string $default
* @param array $output
*
* @return Permission
*
* @throws \Exception
*/
public static function loadPermission(string $name, array $data, string $default = Permission::DEFAULT_OP, array &$output = []) : Permission{
@@ -127,8 +115,6 @@ class PermissionParser{
/**
* @param Permission[] $permissions
*
* @return array
*/
public static function emitPermissions(array $permissions) : array{
$result = [];

View File

@@ -26,10 +26,5 @@ namespace pocketmine\permission;
interface PermissionRemovedExecutor{
/**
* @param PermissionAttachment $attachment
*
* @return void
*/
public function attachmentRemoved(PermissionAttachment $attachment) : void;
}

View File

@@ -27,15 +27,11 @@ namespace pocketmine\permission;
interface ServerOperator{
/**
* Checks if the current object has operator permissions
*
* @return bool
*/
public function isOp() : bool;
/**
* Sets the operator permission for the current object
*
* @param bool $value
*/
public function setOp(bool $value) : void;
}