From cb7c9800e2ea4db78e060c5acf84708c7b22a925 Mon Sep 17 00:00:00 2001 From: toby7002 <144540995+toby7002@users.noreply.github.com> Date: Fri, 20 Oct 2023 00:24:54 +0700 Subject: [PATCH] Fix CS --- src/thebigcrafter/omp/OhMyPMMP.php | 1 - .../omp/cache/InstalledPluginCache.php | 5 +---- .../omp/cache/InstalledPluginsPool.php | 1 - .../omp/commands/subcommands/HelpCommand.php | 3 --- .../omp/commands/subcommands/ListCommand.php | 13 +++++++++---- src/thebigcrafter/omp/lang/OMPLanguage.php | 1 + .../omp/tasks/CacheInstalledPlugins.php | 8 -------- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/thebigcrafter/omp/OhMyPMMP.php b/src/thebigcrafter/omp/OhMyPMMP.php index 2fb51f2..531e967 100644 --- a/src/thebigcrafter/omp/OhMyPMMP.php +++ b/src/thebigcrafter/omp/OhMyPMMP.php @@ -13,7 +13,6 @@ use pocketmine\plugin\PluginBase; use pocketmine\utils\SingletonTrait; -use pocketmine\utils\TextFormat; use Symfony\Component\Filesystem\Path; use thebigcrafter\Fluorine\Fluorine; use thebigcrafter\Iodine\Iodine; diff --git a/src/thebigcrafter/omp/cache/InstalledPluginCache.php b/src/thebigcrafter/omp/cache/InstalledPluginCache.php index cd14da1..4e3c492 100644 --- a/src/thebigcrafter/omp/cache/InstalledPluginCache.php +++ b/src/thebigcrafter/omp/cache/InstalledPluginCache.php @@ -11,9 +11,6 @@ namespace thebigcrafter\omp\cache; -use function count; -use function sort; - class InstalledPluginCache { public function __construct(private string $name, private string $version, private string $description) @@ -28,7 +25,7 @@ public function getVersion() : string { return $this->version; } - public function getDescription(): string { + public function getDescription() : string { return $this->description; } } diff --git a/src/thebigcrafter/omp/cache/InstalledPluginsPool.php b/src/thebigcrafter/omp/cache/InstalledPluginsPool.php index 794fac2..9d0e8f9 100644 --- a/src/thebigcrafter/omp/cache/InstalledPluginsPool.php +++ b/src/thebigcrafter/omp/cache/InstalledPluginsPool.php @@ -11,7 +11,6 @@ namespace thebigcrafter\omp\cache; -use Generator; use SplObjectStorage; final class InstalledPluginsPool { diff --git a/src/thebigcrafter/omp/commands/subcommands/HelpCommand.php b/src/thebigcrafter/omp/commands/subcommands/HelpCommand.php index c0c4303..97db9ae 100644 --- a/src/thebigcrafter/omp/commands/subcommands/HelpCommand.php +++ b/src/thebigcrafter/omp/commands/subcommands/HelpCommand.php @@ -13,9 +13,6 @@ use CortexPE\Commando\BaseSubCommand; use pocketmine\command\CommandSender; -use pocketmine\Server; -use thebigcrafter\omp\OhMyPMMP; -use function phpversion; class HelpCommand extends BaseSubCommand { protected function prepare() : void { diff --git a/src/thebigcrafter/omp/commands/subcommands/ListCommand.php b/src/thebigcrafter/omp/commands/subcommands/ListCommand.php index a990d14..219e3c2 100644 --- a/src/thebigcrafter/omp/commands/subcommands/ListCommand.php +++ b/src/thebigcrafter/omp/commands/subcommands/ListCommand.php @@ -15,13 +15,18 @@ use CortexPE\Commando\args\RawStringArgument; use CortexPE\Commando\BaseSubCommand; use pocketmine\command\CommandSender; -use pocketmine\Server; use thebigcrafter\omp\cache\InstalledPluginCache; use thebigcrafter\omp\cache\InstalledPluginsPool; use thebigcrafter\omp\cache\PluginCache; use thebigcrafter\omp\cache\PluginsPool; use thebigcrafter\omp\OhMyPMMP; -use function phpversion; +use function ceil; +use function count; +use function implode; +use function iterator_count; +use function max; +use function var_dump; +use const PHP_EOL; class ListCommand extends BaseSubCommand { const PLUGINS_PER_PAGE = 10; @@ -99,7 +104,7 @@ public function onRun(CommandSender $sender,string $aliasUsed,array $args) : voi } } - private function renderPluginsBlock(CommandSender $sender, PluginCache $plugin): void + private function renderPluginsBlock(CommandSender $sender, PluginCache $plugin) : void { $sender->sendMessage("================" . PHP_EOL); $sender->sendMessage("# " . OhMyPMMP::getLanguage()->translate("command.list.plugin.name", ["name" => $plugin->getName()])); @@ -112,7 +117,7 @@ private function renderPluginsBlock(CommandSender $sender, PluginCache $plugin): $sender->sendMessage("================" . PHP_EOL . PHP_EOL); } - private function renderInstalledPluginsBlock(CommandSender $sender, InstalledPluginCache $plugin): void + private function renderInstalledPluginsBlock(CommandSender $sender, InstalledPluginCache $plugin) : void { $sender->sendMessage("================" . PHP_EOL); $sender->sendMessage("# " . OhMyPMMP::getLanguage()->translate("command.list.plugin.name", ["name" => $plugin->getName()])); diff --git a/src/thebigcrafter/omp/lang/OMPLanguage.php b/src/thebigcrafter/omp/lang/OMPLanguage.php index 2b23f45..d850590 100644 --- a/src/thebigcrafter/omp/lang/OMPLanguage.php +++ b/src/thebigcrafter/omp/lang/OMPLanguage.php @@ -53,6 +53,7 @@ public function setDefaultLanguage(string $name) : void /** * @param array $placeholders + * @throws Exception */ public function translate(string $key, array $placeholders = []) : string { diff --git a/src/thebigcrafter/omp/tasks/CacheInstalledPlugins.php b/src/thebigcrafter/omp/tasks/CacheInstalledPlugins.php index 365f76b..3a9366f 100644 --- a/src/thebigcrafter/omp/tasks/CacheInstalledPlugins.php +++ b/src/thebigcrafter/omp/tasks/CacheInstalledPlugins.php @@ -11,20 +11,12 @@ namespace thebigcrafter\omp\tasks; -use pocketmine\utils\InternetException; use thebigcrafter\Iodine\Future; use thebigcrafter\Iodine\Iodine; use thebigcrafter\omp\cache\InstalledPluginCache; use thebigcrafter\omp\cache\InstalledPluginsPool; -use thebigcrafter\omp\cache\PluginCache; -use thebigcrafter\omp\cache\PluginsPool; -use thebigcrafter\omp\cache\PluginVersion; use thebigcrafter\omp\OhMyPMMP; -use thebigcrafter\omp\utils\Internet; -use thebigcrafter\omp\Vars; -use function array_merge; use function count; -use function json_decode; use function sort; class CacheInstalledPlugins