Consistent fluency for block property setters

This commit is contained in:
Dylan K. Taylor
2020-08-06 13:46:08 +01:00
parent 3d4470ed8d
commit 7399e6944e
8 changed files with 36 additions and 12 deletions

View File

@ -81,13 +81,15 @@ class FlowerPot extends Flowable{
return $this->plant;
}
public function setPlant(?Block $plant) : void{
/** @return $this */
public function setPlant(?Block $plant) : self{
if($plant === null or $plant instanceof Air){
$this->plant = null;
}else{
$this->plant = clone $plant;
}
$this->occupied = $this->plant !== null;
return $this;
}
public function canAddPlant(Block $block) : bool{