Skip to content

Commit

Permalink
Merge pull request #59 from seregazhuk/use-const-for-php-binary
Browse files Browse the repository at this point in the history
Use predefined const for PHP binary
  • Loading branch information
seregazhuk authored Dec 6, 2019
2 parents ece1b45 + a1e966c commit 507e94b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/Screen/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down

0 comments on commit 507e94b

Please sign in to comment.