diff --git a/src/Deployer.php b/src/Deployer.php index 6e32e6d7d..fe3f4799c 100755 --- a/src/Deployer.php +++ b/src/Deployer.php @@ -51,8 +51,6 @@ use Throwable; /** - * Deployer class represents DI container for configuring - * * @property Application $console * @property InputInterface $input * @property OutputInterface $output @@ -74,9 +72,6 @@ */ class Deployer extends Container { - /** - * Global instance of deployer. It's can be accessed only after constructor call. - */ private static Deployer $instance; public function __construct(Application $console) @@ -192,10 +187,7 @@ public static function get(): self return self::$instance; } - /** - * Init console application - */ - public function init() + public function init(): void { $this->addTaskCommands(); $this->getConsole()->add(new BlackjackCommand()); @@ -218,7 +210,7 @@ public function init() /** * Transform tasks to console commands. */ - public function addTaskCommands() + public function addTaskCommands(): void { foreach ($this->tasks as $name => $task) { $command = new MainCommand($name, $task->getDescription(), $this); @@ -228,11 +220,7 @@ public function addTaskCommands() } } - /** - * @return mixed - * @throws \InvalidArgumentException - */ - public function __get(string $name) + public function __get(string $name): mixed { if (isset($this[$name])) { return $this[$name]; @@ -241,10 +229,7 @@ public function __get(string $name) } } - /** - * @param mixed $value - */ - public function __set(string $name, $value) + public function __set(string $name, mixed $value): void { $this[$name] = $value; } @@ -259,10 +244,7 @@ public function getHelper(string $name): Console\Helper\HelperInterface return $this->getConsole()->getHelperSet()->get($name); } - /** - * Run Deployer - */ - public static function run(string $version, ?string $deployFile) + public static function run(string $version, ?string $deployFile): void { if (str_contains($version, 'master')) { // Get version from composer.lock @@ -295,7 +277,6 @@ public static function run(string $version, ?string $deployFile) $output = new ConsoleOutput(); try { - // Init Deployer $console = new Application('Deployer', $version); $deployer = new self($console); @@ -304,7 +285,6 @@ public static function run(string $version, ?string $deployFile) $deployer->importer->import($deployFile); } - // Run Deployer $deployer->init(); $console->run($input, $output); @@ -318,7 +298,7 @@ public static function run(string $version, ?string $deployFile) } } - public static function printException(OutputInterface $output, Throwable $exception) + public static function printException(OutputInterface $output, Throwable $exception): void { $class = get_class($exception); $file = basename($exception->getFile()); @@ -345,11 +325,9 @@ public static function isWorker(): bool } /** - * @param mixed ...$arguments * @return array|bool|string - * @throws \Exception */ - public static function masterCall(Host $host, string $func, ...$arguments) + public static function masterCall(Host $host, string $func, mixed ...$arguments): mixed { // As request to master will stop master permanently, wait a little bit // in order for ticker gather worker outputs and print it to user. @@ -368,6 +346,6 @@ public static function masterCall(Host $host, string $func, ...$arguments) public static function isPharArchive(): bool { - return 'phar:' === substr(__FILE__, 0, 5); + return str_starts_with(__FILE__, 'phar:'); } }