mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
ObjectSet: make add() and remove() variadic to match ds
there are still some variadic usages in the code, which, infuriatingly, phpstan does not detect (phpstan/phpstan#4528).
This commit is contained in:
parent
c61f66d973
commit
672622950f
@ -37,14 +37,18 @@ final class ObjectSet implements \IteratorAggregate{
|
||||
*/
|
||||
private array $objects = [];
|
||||
|
||||
/** @phpstan-param T $object */
|
||||
public function add(object $object) : void{
|
||||
$this->objects[spl_object_id($object)] = $object;
|
||||
/** @phpstan-param T ...$objects */
|
||||
public function add(object ...$objects) : void{
|
||||
foreach($objects as $object){
|
||||
$this->objects[spl_object_id($object)] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
/** @phpstan-param T $object */
|
||||
public function remove(object $object) : void{
|
||||
unset($this->objects[spl_object_id($object)]);
|
||||
/** @phpstan-param T ...$objects */
|
||||
public function remove(object ...$objects) : void{
|
||||
foreach($objects as $object){
|
||||
unset($this->objects[spl_object_id($object)]);
|
||||
}
|
||||
}
|
||||
|
||||
public function clear() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user