Replace empty() usages with count()

This commit is contained in:
Dylan K. Taylor
2019-12-18 11:06:28 +00:00
parent b08c38f8f9
commit 494660102e
23 changed files with 58 additions and 43 deletions

View File

@ -263,7 +263,7 @@ abstract class Living extends Entity implements Damageable{
* @return bool
*/
public function hasEffects() : bool{
return !empty($this->effects);
return count($this->effects) > 0;
}
/**
@ -332,7 +332,7 @@ abstract class Living extends Entity implements Damageable{
}
}
if(!empty($colors)){
if(count($colors) > 0){
$this->propertyManager->setInt(Entity::DATA_POTION_COLOR, Color::mix(...$colors)->toARGB());
$this->propertyManager->setByte(Entity::DATA_POTION_AMBIENT, $ambient ? 1 : 0);
}else{
@ -713,7 +713,7 @@ abstract class Living extends Entity implements Damageable{
}
}
return !empty($this->effects);
return count($this->effects) > 0;
}
/**
@ -893,7 +893,7 @@ abstract class Living extends Entity implements Damageable{
*/
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{
$line = $this->getLineOfSight($maxDistance, 1, $transparent);
if(!empty($line)){
if(count($line) > 0){
return array_shift($line);
}