Stop cloning Color objects

since these are now immutable, there's no need to clone them.
This commit is contained in:
Dylan K. Taylor 2019-07-05 16:20:56 +01:00
parent f356bf0893
commit 77919b70b2
2 changed files with 3 additions and 7 deletions

View File

@ -279,7 +279,7 @@ class Effect{
* @return Color
*/
public function getColor() : Color{
return clone $this->color;
return $this->color;
}
/**
@ -350,8 +350,4 @@ class Effect{
public function remove(Living $entity, EffectInstance $instance) : void{
}
public function __clone(){
$this->color = clone $this->color;
}
}

View File

@ -198,7 +198,7 @@ class EffectInstance{
* @return Color
*/
public function getColor() : Color{
return clone $this->color;
return $this->color;
}
/**
@ -209,7 +209,7 @@ class EffectInstance{
* @return EffectInstance
*/
public function setColor(Color $color) : EffectInstance{
$this->color = clone $color;
$this->color = $color;
return $this;
}