Skip to content

Commit

Permalink
Merge pull request #76 from MilanPala/return-types
Browse files Browse the repository at this point in the history
Added return types according to the Symfony Commands
  • Loading branch information
Spamercz authored Aug 19, 2021
2 parents 6501297 + 533b862 commit 34e519f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Kdyby/RabbitMq/Command/BaseConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
}
}

protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->consumer->consume($this->amount);

return \Symfony\Component\Console\Command\Command::SUCCESS;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Kdyby/RabbitMq/Command/PurgeConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$consumer = $this->connection->getConsumer($input->getArgument('name'));
$consumer->purge();

return 0;
return \Symfony\Component\Console\Command\Command::SUCCESS;
}

}
4 changes: 3 additions & 1 deletion src/Kdyby/RabbitMq/Command/RpcServerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function configure(): void
*
* @throws \InvalidArgumentException When the number of messages to consume is less than 0
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
\define('AMQP_DEBUG', (bool) $input->getOption('debug'));

Expand All @@ -45,6 +45,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void

$rpcServer = $this->connection->getRpcServer($input->getArgument('name'));
$rpcServer->start($amount);

return \Symfony\Component\Console\Command\Command::SUCCESS;
}

}
4 changes: 3 additions & 1 deletion src/Kdyby/RabbitMq/Command/SetupFabricCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function configure(): void
->addOption('debug', 'd', InputOption::VALUE_NONE, 'Enable Debugging');
}

protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
if (\defined('AMQP_DEBUG') === FALSE) {
\define('AMQP_DEBUG', (bool) $input->getOption('debug'));
Expand All @@ -46,6 +46,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void
$service->setupFabric();
}
}

return \Symfony\Component\Console\Command\Command::SUCCESS;
}

}
4 changes: 3 additions & 1 deletion src/Kdyby/RabbitMq/Command/StdInProducerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function configure(): void
/**
* Executes the current command.
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
\define('AMQP_DEBUG', (bool) $input->getOption('debug'));

Expand All @@ -42,6 +42,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void
}

$producer->publish(\serialize($data));

return \Symfony\Component\Console\Command\Command::SUCCESS;
}

}

0 comments on commit 34e519f

Please sign in to comment.