From a1e966c2d22a86d2bdf5f494d6550d32f10d857f Mon Sep 17 00:00:00 2001 From: Zhuk Sergey Date: Fri, 6 Dec 2019 15:21:30 +0300 Subject: [PATCH] Use predefined const for PHP binary --- src/Config/Config.php | 5 ++--- src/Screen/Screen.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Config/Config.php b/src/Config/Config.php index d57f1e1..3713ac9 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -4,7 +4,6 @@ final class Config { - private const DEFAULT_PHP_EXECUTABLE = 'php'; private const DEFAULT_DELAY_IN_SECONDS = 0.25; private const DEFAULT_SIGNAL = SIGINT; @@ -28,7 +27,7 @@ final class Config public function __construct(?string $script, ?string $phpExecutable, ?int $signal, ?float $delay, array $arguments, bool $spinnerDisabled, WatchList $watchList) { $this->script = $script; - $this->phpExecutable = $phpExecutable ?: self::DEFAULT_PHP_EXECUTABLE; + $this->phpExecutable = $phpExecutable ?: PHP_BINARY; $this->signal = $signal ?: self::DEFAULT_SIGNAL; $this->delay = $delay ?: self::DEFAULT_DELAY_IN_SECONDS; $this->arguments = $arguments; @@ -88,7 +87,7 @@ public function merge(self $another): self { return new self( empty($this->script) && $another->script ? $another->script : $this->script, - $this->phpExecutable === self::DEFAULT_PHP_EXECUTABLE && $another->phpExecutable ? $another->phpExecutable: $this->phpExecutable, + $this->phpExecutable === PHP_BINARY && $another->phpExecutable ? $another->phpExecutable: $this->phpExecutable, $this->signal === self::DEFAULT_SIGNAL && $another->signal ? $another->signal : $this->signal, $this->delay === self::DEFAULT_DELAY_IN_SECONDS && $another->delay ? $another->delay: $this->delay, empty($this->arguments) && !empty($another->arguments) ? $another->arguments : $this->arguments, diff --git a/src/Screen/Screen.php b/src/Screen/Screen.php index bae1c77..5c49c27 100644 --- a/src/Screen/Screen.php +++ b/src/Screen/Screen.php @@ -62,7 +62,7 @@ private function warning(string $text): void public function start(string $command): void { - $command = str_replace('exec', '', $command); + $command = str_replace(['exec', PHP_BINARY], ['', 'php'], $command); $this->info(sprintf('starting `%s`', trim($command))); }