Skip to content

Commit

Permalink
Update command execution definitions to the latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin de Keijzer committed Mar 2, 2022
1 parent 54dd916 commit a189c06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 9 additions & 7 deletions Command/BroadcasterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use Martin1982\LiveBroadcastBundle\Broadcaster\Scheduler;
use Psr\Log\LoggerInterface;
use React\EventLoop\Factory;
use React\EventLoop\Loop;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -24,17 +24,17 @@ class BroadcasterCommand extends Command
/**
* @var Scheduler
*/
private $scheduler;
private Scheduler $scheduler;

/**
* @var LoggerInterface
*/
private $logger;
private LoggerInterface $logger;

/**
* @var int
*/
private $eventLoopTimer;
private int $eventLoopTimer;

/**
* @var string
Expand All @@ -47,7 +47,7 @@ class BroadcasterCommand extends Command
* @param int $eventLoopTimer
*
*/
public function __construct(Scheduler $scheduler, LoggerInterface $logger, $eventLoopTimer = 10)
public function __construct(Scheduler $scheduler, LoggerInterface $logger, int $eventLoopTimer = 10)
{
$this->scheduler = $scheduler;
$this->logger = $logger;
Expand All @@ -69,11 +69,11 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$scheduler = $this->scheduler;

$eventLoop = Factory::create();
$eventLoop = Loop::get();
$eventLoop->addPeriodicTimer(
$this->eventLoopTimer,
function () use ($scheduler) {
Expand All @@ -86,5 +86,7 @@ function () use ($scheduler) {
);

$eventLoop->run();

return 0;
}
}
12 changes: 7 additions & 5 deletions Command/ShellTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class ShellTestCommand extends Command
/**
* @var bool
*/
private $isWindows = false;
private bool $isWindows = false;

/**
* @var bool
*/
private $isMac = false;
private bool $isMac = false;

/**
* @var bool
*/
private $isLinux = false;
private bool $isLinux = false;

/**
* @var string
Expand All @@ -51,7 +51,7 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
switch (strtoupper(substr(PHP_OS, 0, 3))) {
case 'WIN':
Expand Down Expand Up @@ -89,6 +89,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->write('Checking \'grep\' command availability... ');
$this->testGrep($output);
}

return 0;
}

/**
Expand Down Expand Up @@ -164,7 +166,7 @@ protected function testKill(OutputInterface $output): void
* @param string $testable
* @param OutputInterface $output
*/
protected function analyseResult($cmdResult, $testable, OutputInterface $output): void
protected function analyseResult(array $cmdResult, string $testable, OutputInterface $output): void
{
if (count($cmdResult) && 0 !== preg_match('/'.$testable.'/', implode($cmdResult))) {
$output->writeln('<info>[OK]</info>');
Expand Down

0 comments on commit a189c06

Please sign in to comment.