diff --git a/src/command/Command.php b/src/command/Command.php index ea324a933..6b1d6ab33 100644 --- a/src/command/Command.php +++ b/src/command/Command.php @@ -127,7 +127,7 @@ abstract class Command{ public function testPermissionSilent(CommandSender $target, ?string $permission = null) : bool{ $permission ??= $this->permission; - if($permission === null or $permission === ""){ + if($permission === null || $permission === ""){ return true; } @@ -182,7 +182,7 @@ abstract class Command{ } private function allowChangesFrom(CommandMap $commandMap) : bool{ - return $this->commandMap === null or $this->commandMap === $commandMap; + return $this->commandMap === null || $this->commandMap === $commandMap; } public function isRegistered() : bool{ @@ -235,7 +235,7 @@ abstract class Command{ $result = KnownTranslationFactory::chat_type_admin($source->getName(), $message); $colored = $result->prefix(TextFormat::GRAY . TextFormat::ITALIC); - if($sendToSource and !($source instanceof ConsoleCommandSender)){ + if($sendToSource && !($source instanceof ConsoleCommandSender)){ $source->sendMessage($message); } diff --git a/src/command/FormattedCommandAlias.php b/src/command/FormattedCommandAlias.php index f6e11f5e5..968c10012 100644 --- a/src/command/FormattedCommandAlias.php +++ b/src/command/FormattedCommandAlias.php @@ -71,7 +71,7 @@ class FormattedCommandAlias extends Command{ $index = strpos($formatString, '$'); while($index !== false){ $start = $index; - if($index > 0 and $formatString[$start - 1] === "\\"){ + if($index > 0 && $formatString[$start - 1] === "\\"){ $formatString = substr($formatString, 0, $start - 1) . substr($formatString, $start); $index = strpos($formatString, '$', $index); continue; @@ -88,7 +88,7 @@ class FormattedCommandAlias extends Command{ $argStart = $index; - while($index < strlen($formatString) and self::inRange(ord($formatString[$index]) - 48, 0, 9)){ + while($index < strlen($formatString) && self::inRange(ord($formatString[$index]) - 48, 0, 9)){ ++$index; } @@ -106,19 +106,19 @@ class FormattedCommandAlias extends Command{ $rest = false; - if($index < strlen($formatString) and $formatString[$index] === "-"){ + if($index < strlen($formatString) && $formatString[$index] === "-"){ $rest = true; ++$index; } $end = $index; - if($required and $position >= count($args)){ + if($required && $position >= count($args)){ throw new \InvalidArgumentException("Missing required argument " . ($position + 1)); } $replacement = ""; - if($rest and $position < count($args)){ + if($rest && $position < count($args)){ for($i = $position, $c = count($args); $i < $c; ++$i){ if($i !== $position){ $replacement .= " "; @@ -141,6 +141,6 @@ class FormattedCommandAlias extends Command{ } private static function inRange(int $i, int $j, int $k) : bool{ - return $i >= $j and $i <= $k; + return $i >= $j && $i <= $k; } } diff --git a/src/command/PluginCommand.php b/src/command/PluginCommand.php index 2453f4025..634978006 100644 --- a/src/command/PluginCommand.php +++ b/src/command/PluginCommand.php @@ -53,7 +53,7 @@ final class PluginCommand extends Command implements PluginOwned{ $success = $this->executor->onCommand($sender, $this, $commandLabel, $args); - if(!$success and $this->usageMessage !== ""){ + if(!$success && $this->usageMessage !== ""){ throw new InvalidCommandSyntaxException(); } diff --git a/src/command/SimpleCommandMap.php b/src/command/SimpleCommandMap.php index 2d18972c5..116f59c23 100644 --- a/src/command/SimpleCommandMap.php +++ b/src/command/SimpleCommandMap.php @@ -183,11 +183,11 @@ class SimpleCommandMap implements CommandMap{ private function registerAlias(Command $command, bool $isAlias, string $fallbackPrefix, string $label) : bool{ $this->knownCommands[$fallbackPrefix . ":" . $label] = $command; - if(($command instanceof VanillaCommand or $isAlias) and isset($this->knownCommands[$label])){ + if(($command instanceof VanillaCommand || $isAlias) && isset($this->knownCommands[$label])){ return false; } - if(isset($this->knownCommands[$label]) and $this->knownCommands[$label]->getLabel() === $label){ + if(isset($this->knownCommands[$label]) && $this->knownCommands[$label]->getLabel() === $label){ return false; } diff --git a/src/command/defaults/ClearCommand.php b/src/command/defaults/ClearCommand.php index 472321135..237f3d108 100644 --- a/src/command/defaults/ClearCommand.php +++ b/src/command/defaults/ClearCommand.php @@ -105,7 +105,7 @@ class ClearCommand extends VanillaCommand{ ]; // Checking player's inventory for all the items matching the criteria - if($targetItem !== null and $maxCount === 0){ + if($targetItem !== null && $maxCount === 0){ $count = $this->countItems($inventories, $targetItem); if($count > 0){ $sender->sendMessage(KnownTranslationFactory::commands_clear_testing($target->getName(), (string) $count)); diff --git a/src/command/defaults/EffectCommand.php b/src/command/defaults/EffectCommand.php index 7b2541ea7..fe2db7d2d 100644 --- a/src/command/defaults/EffectCommand.php +++ b/src/command/defaults/EffectCommand.php @@ -96,7 +96,7 @@ class EffectCommand extends VanillaCommand{ $visible = true; if(count($args) >= 5){ $v = strtolower($args[4]); - if($v === "on" or $v === "true" or $v === "t" or $v === "1"){ + if($v === "on" || $v === "true" || $v === "t" || $v === "1"){ $visible = false; } } diff --git a/src/command/defaults/ListCommand.php b/src/command/defaults/ListCommand.php index a19130e3f..c451877ae 100644 --- a/src/command/defaults/ListCommand.php +++ b/src/command/defaults/ListCommand.php @@ -52,7 +52,7 @@ class ListCommand extends VanillaCommand{ $playerNames = array_map(function(Player $player) : string{ return $player->getName(); }, array_filter($sender->getServer()->getOnlinePlayers(), function(Player $player) use ($sender) : bool{ - return !($sender instanceof Player) or $sender->canSee($player); + return !($sender instanceof Player) || $sender->canSee($player); })); sort($playerNames, SORT_STRING); diff --git a/src/command/defaults/ParticleCommand.php b/src/command/defaults/ParticleCommand.php index ee7af129a..072ca9dc8 100644 --- a/src/command/defaults/ParticleCommand.php +++ b/src/command/defaults/ParticleCommand.php @@ -181,12 +181,12 @@ class ParticleCommand extends VanillaCommand{ case "slime": return new ItemBreakParticle(VanillaItems::SLIMEBALL()); case "itembreak": - if($data !== null and $data !== 0){ + if($data !== null && $data !== 0){ return new ItemBreakParticle(ItemFactory::getInstance()->get($data)); } break; case "terrain": - if($data !== null and $data !== 0){ + if($data !== null && $data !== 0){ return new TerrainParticle(BlockFactory::getInstance()->get($data, 0)); } break; diff --git a/src/command/defaults/TimingsCommand.php b/src/command/defaults/TimingsCommand.php index c894bb94f..13c95b5bd 100644 --- a/src/command/defaults/TimingsCommand.php +++ b/src/command/defaults/TimingsCommand.php @@ -103,7 +103,7 @@ class TimingsCommand extends VanillaCommand{ if($mode === "reset"){ TimingsHandler::reload(); Command::broadcastCommandMessage($sender, KnownTranslationFactory::pocketmine_command_timings_reset()); - }elseif($mode === "merged" or $mode === "report" or $paste){ + }elseif($mode === "merged" || $mode === "report" || $paste){ $timings = ""; if($paste){ $fileTimings = Utils::assumeNotFalse(fopen("php://temp", "r+b"), "Opening php://temp should never fail"); @@ -154,7 +154,7 @@ class TimingsCommand extends VanillaCommand{ )], function(array $results) use ($sender, $host) : void{ /** @phpstan-var array $results */ - if($sender instanceof Player and !$sender->isOnline()){ // TODO replace with a more generic API method for checking availability of CommandSender + if($sender instanceof Player && !$sender->isOnline()){ // TODO replace with a more generic API method for checking availability of CommandSender return; } $result = $results[0];