Skip to content

Commit 0afc54c

Browse files
Fixed daemon run command bugs highlighted by test
1 parent f97300b commit 0afc54c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Command/DaemonRunCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,18 @@ public function __construct($name, $description, DaemonFactoryInterface $daemonF
5353
*/
5454
protected function execute(InputInterface $input, OutputInterface $output)
5555
{
56-
if ($input->hasOption('port')) {
56+
$port = $input->getOption('port');
57+
$host = $input->getOption('host');
58+
59+
if (null !== $port) {
5760
// If we have the port, create a TCP daemon
58-
$port = $input->getOption('port');
5961

60-
if ($input->hasOption('host')) {
61-
$host = $input->getOption('host');
62+
if (null !== $host) {
6263
$daemon = $this->daemonFactory->createTcpDaemon($this->kernel, $port, $host);
6364
} else {
6465
$daemon = $this->daemonFactory->createTcpDaemon($this->kernel, $port);
6566
}
66-
} elseif ($input->hasOption('host')) {
67+
} elseif (null !== $host) {
6768
// If we have the host but not the port, we cant create a TCP daemon - throw exception
6869
throw new \InvalidArgumentException('TCP port option must be set if host option is set');
6970
} else {

0 commit comments

Comments
 (0)