mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 10:19:39 +00:00
AttributeMap: drop ArrayAccess interface
this makes no sense because it isn't type safe and isn't used anywhere. It's just extra maintenance cost for no good reason.
This commit is contained in:
parent
c1ef5ba8ab
commit
e03f918806
@ -25,7 +25,7 @@ namespace pocketmine\entity;
|
||||
|
||||
use function array_filter;
|
||||
|
||||
class AttributeMap implements \ArrayAccess{
|
||||
class AttributeMap{
|
||||
/** @var Attribute[] */
|
||||
private $attributes = [];
|
||||
|
||||
@ -57,29 +57,4 @@ class AttributeMap implements \ArrayAccess{
|
||||
return $attribute->isSyncable() and $attribute->isDesynchronized();
|
||||
});
|
||||
}
|
||||
|
||||
public function offsetExists($offset) : bool{
|
||||
return isset($this->attributes[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $offset
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function offsetGet($offset) : float{
|
||||
return $this->attributes[$offset]->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $offset
|
||||
* @param float $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) : void{
|
||||
$this->attributes[$offset]->setValue($value);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) : void{
|
||||
throw new \RuntimeException("Could not unset an attribute from an attribute map");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user