More typehints, documentation fixes and static analysis cleanup

This commit is contained in:
Dylan K. Taylor
2017-07-15 12:12:06 +01:00
parent 24bdf330d5
commit dbb92096e4
66 changed files with 309 additions and 219 deletions

View File

@ -44,7 +44,7 @@ abstract class Tree{
public $leafBlock = Block::LEAVES;
public $treeHeight = 7;
public static function growTree(ChunkManager $level, $x, $y, $z, Random $random, $type = 0){
public static function growTree(ChunkManager $level, int $x, int $y, int $z, Random $random, int $type = 0){
switch($type){
case Sapling::SPRUCE:
$tree = new SpruceTree();
@ -78,7 +78,7 @@ abstract class Tree{
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random) : bool{
$radiusToCheck = 0;
for($yy = 0; $yy < $this->treeHeight + 3; ++$yy){
if($yy == 1 or $yy === $this->treeHeight){
if($yy === 1 or $yy === $this->treeHeight){
++$radiusToCheck;
}
for($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){
@ -93,7 +93,7 @@ abstract class Tree{
return true;
}
public function placeObject(ChunkManager $level, $x, $y, $z, Random $random){
public function placeObject(ChunkManager $level, int $x, int $y, int $z, Random $random){
$this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - 1);
@ -116,7 +116,7 @@ abstract class Tree{
}
}
protected function placeTrunk(ChunkManager $level, $x, $y, $z, Random $random, $trunkHeight){
protected function placeTrunk(ChunkManager $level, int $x, int $y, int $z, Random $random, int $trunkHeight){
// The base dirt block
$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);