Skip to content

Commit

Permalink
Merge pull request #134 from grizzm0/update/symfony-console
Browse files Browse the repository at this point in the history
Updated dependency symfony/console to ^5.3 || ^6.0.19 || ^7.0
  • Loading branch information
arhimede authored Oct 15, 2024
2 parents 3ab78a3 + 1bd0155 commit 54477ef
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 106 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"composer/package-versions-deprecated": true
},
"platform": {
"php": "8.1.99"
"php": "8.2.99"
}
},
"extra": {
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.2.0 || ~8.3.0",
"dflydev/fig-cookies": "^2.0.1 || ^3.0",
"laminas/laminas-cli": "^1.8",
"laminas/laminas-diactoros": "^2.25.2 || ^3.0",
Expand All @@ -47,7 +47,7 @@
"psr/http-message-implementation": "^1.0 || ^2.0",
"psr/http-server-handler": "^1.0.2",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/console": "^5.0 || ^6.0.19",
"symfony/console": "^5.3 || ^6.0.19 || ^7.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
Expand Down
116 changes: 24 additions & 92 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@
<code>$cacheControlDirectives[$regex]</code>
</MixedArrayOffset>
</file>
<file src="src/Command/ReloadCommand.php">
<PossiblyUnusedProperty>
<code>$defaultName</code>
</PossiblyUnusedProperty>
</file>
<file src="src/Command/StartCommand.php">
<PossiblyUnusedProperty>
<code>$defaultName</code>
</PossiblyUnusedProperty>
</file>
<file src="src/Command/StatusCommand.php">
<PossiblyUnusedProperty>
<code>$defaultName</code>
</PossiblyUnusedProperty>
</file>
<file src="src/Command/StopCommand.php">
<PossiblyUnusedProperty>
<code>$defaultName</code>
</PossiblyUnusedProperty>
</file>
<file src="src/Event/ServerShutdownEvent.php">
<PossiblyUnusedMethod>
<code>getServer</code>
Expand Down
12 changes: 9 additions & 3 deletions src/Command/ReloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Mezzio\Swoole\Command;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -19,6 +20,7 @@

use const SWOOLE_PROCESS;

#[AsCommand('mezzio:swoole:reload')]
class ReloadCommand extends Command
{
/**
Expand All @@ -33,7 +35,11 @@ class ReloadCommand extends Command
configuration value is set to SWOOLE_PROCESS.
EOH;

/** @var null|string Cannot be defined explicitly due to parent class */
/**
* @deprecated Use ReloadCommand::getDefaultName() instead. Will be removed in 5.0.0
*
* @var null|string
*/
public static $defaultName = 'mezzio:swoole:reload';

public function __construct(private int $serverMode)
Expand Down Expand Up @@ -73,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
/** @var Application $application */
$application = $this->getApplication();

$stop = $application->find(StopCommand::$defaultName);
$stop = $application->find(StopCommand::getDefaultName());
$result = $stop->run(new ArrayInput([
'command' => 'stop',
]), $output);
Expand All @@ -92,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('<info>[DONE]</info>');
$output->writeln('<info>Starting server</info>');

$start = $application->find(StartCommand::$defaultName);
$start = $application->find(StartCommand::getDefaultName());

$inputArguments = [
'command' => 'start',
Expand Down
8 changes: 7 additions & 1 deletion src/Command/StartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
use Mezzio\Swoole\PidManager;
use Psr\Container\ContainerInterface;
use Swoole\Http\Server as SwooleHttpServer;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

use function file_exists;

#[AsCommand('mezzio:swoole:start')]
class StartCommand extends Command
{
use IsRunningTrait;
Expand Down Expand Up @@ -51,7 +53,11 @@ class StartCommand extends Command
'config/routes.php',
];

/** @var null|string Cannot be defined explicitly due to parent class */
/**
* @deprecated Use StartCommand::getDefaultName() instead. Will be removed in 5.0.0
*
* @var null|string
*/
public static $defaultName = 'mezzio:swoole:start';

public function __construct(private ContainerInterface $container)
Expand Down
8 changes: 7 additions & 1 deletion src/Command/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
namespace Mezzio\Swoole\Command;

use Mezzio\Swoole\PidManager;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('mezzio:swoole:status')]
class StatusCommand extends Command
{
use IsRunningTrait;
Expand All @@ -27,7 +29,11 @@ class StatusCommand extends Command
--daemonize option.
EOH;

/** @var null|string Cannot be defined explicitly due to parent class */
/**
* @deprecated Use StatusCommand::getDefaultName() instead. Will be removed in 5.0.0
*
* @var null|string
*/
public static $defaultName = 'mezzio:swoole:status';

public function __construct(private PidManager $pidManager)
Expand Down
8 changes: 7 additions & 1 deletion src/Command/StopCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
use Closure;
use Mezzio\Swoole\PidManager;
use Swoole\Process as SwooleProcess;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use function time;
use function usleep;

#[AsCommand('mezzio:swoole:stop')]
class StopCommand extends Command
{
use IsRunningTrait;
Expand All @@ -32,7 +34,11 @@ class StopCommand extends Command
--daemonize option.
EOH;

/** @var null|string Cannot be defined explicitly due to parent class */
/**
* @deprecated Use StopCommand::getDefaultName() instead. Will be removed in 5.0.0
*
* @var null|string
*/
public static $defaultName = 'mezzio:swoole:stop';

/**
Expand Down
10 changes: 5 additions & 5 deletions test/Command/ReloadCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testExecuteEndsWithErrorWhenStopCommandFails(): void
->willReturn(1);

$application = $this->mockApplication();
$application->method('find')->with(StopCommand::$defaultName)->willReturn($stopCommand);
$application->method('find')->with(StopCommand::getDefaultName())->willReturn($stopCommand);

$command->setApplication($application);

Expand Down Expand Up @@ -200,8 +200,8 @@ public function testExecuteEndsWithErrorWhenStartCommandFails(): void
->expects($this->exactly(2))
->method('find')
->willReturnMap([
[StopCommand::$defaultName, $stopCommand],
[StartCommand::$defaultName, $startCommand],
[StopCommand::getDefaultName(), $stopCommand],
[StartCommand::getDefaultName(), $startCommand],
]);

$command->setApplication($application);
Expand Down Expand Up @@ -270,8 +270,8 @@ public function testExecuteEndsWithSuccessWhenBothStopAndStartCommandsSucceed():
->expects($this->exactly(2))
->method('find')
->willReturnMap([
[StopCommand::$defaultName, $stopCommand],
[StartCommand::$defaultName, $startCommand],
[StopCommand::getDefaultName(), $stopCommand],
[StartCommand::getDefaultName(), $startCommand],
]);

$this->output
Expand Down

0 comments on commit 54477ef

Please sign in to comment.