Removed ext-ds dependency

This commit is contained in:
Dylan K. Taylor
2021-02-11 15:40:37 +00:00
parent b03ca1953a
commit c61f66d973
19 changed files with 231 additions and 106 deletions

View File

@@ -23,8 +23,8 @@ declare(strict_types=1);
namespace pocketmine\permission;
use Ds\Set;
use pocketmine\plugin\Plugin;
use pocketmine\utils\ObjectSet;
interface Permissible{
@@ -73,10 +73,10 @@ interface Permissible{
public function recalculatePermissions() : array;
/**
* @return Set|\Closure[]
* @phpstan-return Set<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
* @return ObjectSet|\Closure[]
* @phpstan-return ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
*/
public function getPermissionRecalculationCallbacks() : Set;
public function getPermissionRecalculationCallbacks() : ObjectSet;
/**
* @return PermissionAttachmentInfo[]

View File

@@ -23,10 +23,10 @@ declare(strict_types=1);
namespace pocketmine\permission;
use Ds\Set;
use pocketmine\plugin\Plugin;
use pocketmine\plugin\PluginException;
use pocketmine\timings\Timings;
use pocketmine\utils\ObjectSet;
use function count;
use function spl_object_id;
@@ -44,8 +44,8 @@ class PermissibleBase implements Permissible{
private $permissions = [];
/**
* @var Set|\Closure[]
* @phpstan-var Set<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
* @var ObjectSet|\Closure[]
* @phpstan-var ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
*/
private $permissionRecalculationCallbacks;
@@ -54,7 +54,7 @@ class PermissibleBase implements Permissible{
* @phpstan-param array<string, bool> $basePermissions
*/
public function __construct(array $basePermissions){
$this->permissionRecalculationCallbacks = new Set();
$this->permissionRecalculationCallbacks = new ObjectSet();
//TODO: we can't setBasePermission here directly due to bad architecture that causes recalculatePermissions to explode
//so, this hack has to be done here to prevent permission recalculations until it's fixed...
@@ -198,10 +198,10 @@ class PermissibleBase implements Permissible{
}
/**
* @return \Closure[]|Set
* @phpstan-return Set<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
* @return \Closure[]|ObjectSet
* @phpstan-return ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
*/
public function getPermissionRecalculationCallbacks() : Set{ return $this->permissionRecalculationCallbacks; }
public function getPermissionRecalculationCallbacks() : ObjectSet{ return $this->permissionRecalculationCallbacks; }
/**
* @return PermissionAttachmentInfo[]

View File

@@ -23,8 +23,8 @@ declare(strict_types=1);
namespace pocketmine\permission;
use Ds\Set;
use pocketmine\plugin\Plugin;
use pocketmine\utils\ObjectSet;
trait PermissibleDelegateTrait{
@@ -72,10 +72,10 @@ trait PermissibleDelegateTrait{
}
/**
* @return Set|\Closure[]
* @phpstan-return Set<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
* @return ObjectSet|\Closure[]
* @phpstan-return ObjectSet<\Closure(array<string, bool> $changedPermissionsOldValues) : void>
*/
public function getPermissionRecalculationCallbacks() : Set{
public function getPermissionRecalculationCallbacks() : ObjectSet{
return $this->perm->getPermissionRecalculationCallbacks();
}