mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
Hinting up Entity API to PHP 7.2 standards
This commit is contained in:
@@ -27,7 +27,7 @@ class AttributeMap implements \ArrayAccess{
|
||||
/** @var Attribute[] */
|
||||
private $attributes = [];
|
||||
|
||||
public function addAttribute(Attribute $attribute){
|
||||
public function addAttribute(Attribute $attribute) : void{
|
||||
$this->attributes[$attribute->getId()] = $attribute;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class AttributeMap implements \ArrayAccess{
|
||||
*
|
||||
* @return Attribute|null
|
||||
*/
|
||||
public function getAttribute(int $id){
|
||||
public function getAttribute(int $id) : ?Attribute{
|
||||
return $this->attributes[$id] ?? null;
|
||||
}
|
||||
|
||||
@@ -56,19 +56,28 @@ class AttributeMap implements \ArrayAccess{
|
||||
});
|
||||
}
|
||||
|
||||
public function offsetExists($offset){
|
||||
public function offsetExists($offset) : bool{
|
||||
return isset($this->attributes[$offset]);
|
||||
}
|
||||
|
||||
public function offsetGet($offset){
|
||||
/**
|
||||
* @param int $offset
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function offsetGet($offset) : float{
|
||||
return $this->attributes[$offset]->getValue();
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value){
|
||||
/**
|
||||
* @param int $offset
|
||||
* @param float $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) : void{
|
||||
$this->attributes[$offset]->setValue($value);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset){
|
||||
public function offsetUnset($offset) : void{
|
||||
throw new \RuntimeException("Could not unset an attribute from an attribute map");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user