Skip to content

Commit 54477ef

Browse files
authored
Merge pull request #134 from grizzm0/update/symfony-console
Updated dependency symfony/console to ^5.3 || ^6.0.19 || ^7.0
2 parents 3ab78a3 + 1bd0155 commit 54477ef

8 files changed

+82
-106
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"composer/package-versions-deprecated": true
3030
},
3131
"platform": {
32-
"php": "8.1.99"
32+
"php": "8.2.99"
3333
}
3434
},
3535
"extra": {
3636
},
3737
"require": {
38-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
38+
"php": "~8.2.0 || ~8.3.0",
3939
"dflydev/fig-cookies": "^2.0.1 || ^3.0",
4040
"laminas/laminas-cli": "^1.8",
4141
"laminas/laminas-diactoros": "^2.25.2 || ^3.0",
@@ -47,7 +47,7 @@
4747
"psr/http-message-implementation": "^1.0 || ^2.0",
4848
"psr/http-server-handler": "^1.0.2",
4949
"psr/log": "^1.0 || ^2.0 || ^3.0",
50-
"symfony/console": "^5.0 || ^6.0.19",
50+
"symfony/console": "^5.3 || ^6.0.19 || ^7.0",
5151
"webmozart/assert": "^1.11"
5252
},
5353
"require-dev": {

composer.lock

+24-92
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

psalm-baseline.xml

+20
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@
55
<code>$cacheControlDirectives[$regex]</code>
66
</MixedArrayOffset>
77
</file>
8+
<file src="src/Command/ReloadCommand.php">
9+
<PossiblyUnusedProperty>
10+
<code>$defaultName</code>
11+
</PossiblyUnusedProperty>
12+
</file>
13+
<file src="src/Command/StartCommand.php">
14+
<PossiblyUnusedProperty>
15+
<code>$defaultName</code>
16+
</PossiblyUnusedProperty>
17+
</file>
18+
<file src="src/Command/StatusCommand.php">
19+
<PossiblyUnusedProperty>
20+
<code>$defaultName</code>
21+
</PossiblyUnusedProperty>
22+
</file>
23+
<file src="src/Command/StopCommand.php">
24+
<PossiblyUnusedProperty>
25+
<code>$defaultName</code>
26+
</PossiblyUnusedProperty>
27+
</file>
828
<file src="src/Event/ServerShutdownEvent.php">
929
<PossiblyUnusedMethod>
1030
<code>getServer</code>

src/Command/ReloadCommand.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Mezzio\Swoole\Command;
1010

1111
use Symfony\Component\Console\Application;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\ArrayInput;
1415
use Symfony\Component\Console\Input\InputInterface;
@@ -19,6 +20,7 @@
1920

2021
use const SWOOLE_PROCESS;
2122

23+
#[AsCommand('mezzio:swoole:reload')]
2224
class ReloadCommand extends Command
2325
{
2426
/**
@@ -33,7 +35,11 @@ class ReloadCommand extends Command
3335
configuration value is set to SWOOLE_PROCESS.
3436
EOH;
3537

36-
/** @var null|string Cannot be defined explicitly due to parent class */
38+
/**
39+
* @deprecated Use ReloadCommand::getDefaultName() instead. Will be removed in 5.0.0
40+
*
41+
* @var null|string
42+
*/
3743
public static $defaultName = 'mezzio:swoole:reload';
3844

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

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

95-
$start = $application->find(StartCommand::$defaultName);
101+
$start = $application->find(StartCommand::getDefaultName());
96102

97103
$inputArguments = [
98104
'command' => 'start',

src/Command/StartCommand.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
use Mezzio\Swoole\PidManager;
1414
use Psr\Container\ContainerInterface;
1515
use Swoole\Http\Server as SwooleHttpServer;
16+
use Symfony\Component\Console\Attribute\AsCommand;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputInterface;
1819
use Symfony\Component\Console\Input\InputOption;
1920
use Symfony\Component\Console\Output\OutputInterface;
2021

2122
use function file_exists;
2223

24+
#[AsCommand('mezzio:swoole:start')]
2325
class StartCommand extends Command
2426
{
2527
use IsRunningTrait;
@@ -51,7 +53,11 @@ class StartCommand extends Command
5153
'config/routes.php',
5254
];
5355

54-
/** @var null|string Cannot be defined explicitly due to parent class */
56+
/**
57+
* @deprecated Use StartCommand::getDefaultName() instead. Will be removed in 5.0.0
58+
*
59+
* @var null|string
60+
*/
5561
public static $defaultName = 'mezzio:swoole:start';
5662

5763
public function __construct(private ContainerInterface $container)

src/Command/StatusCommand.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
namespace Mezzio\Swoole\Command;
1010

1111
use Mezzio\Swoole\PidManager;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Output\OutputInterface;
1516

17+
#[AsCommand('mezzio:swoole:status')]
1618
class StatusCommand extends Command
1719
{
1820
use IsRunningTrait;
@@ -27,7 +29,11 @@ class StatusCommand extends Command
2729
--daemonize option.
2830
EOH;
2931

30-
/** @var null|string Cannot be defined explicitly due to parent class */
32+
/**
33+
* @deprecated Use StatusCommand::getDefaultName() instead. Will be removed in 5.0.0
34+
*
35+
* @var null|string
36+
*/
3137
public static $defaultName = 'mezzio:swoole:status';
3238

3339
public function __construct(private PidManager $pidManager)

src/Command/StopCommand.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
use Closure;
1212
use Mezzio\Swoole\PidManager;
1313
use Swoole\Process as SwooleProcess;
14+
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718

1819
use function time;
1920
use function usleep;
2021

22+
#[AsCommand('mezzio:swoole:stop')]
2123
class StopCommand extends Command
2224
{
2325
use IsRunningTrait;
@@ -32,7 +34,11 @@ class StopCommand extends Command
3234
--daemonize option.
3335
EOH;
3436

35-
/** @var null|string Cannot be defined explicitly due to parent class */
37+
/**
38+
* @deprecated Use StopCommand::getDefaultName() instead. Will be removed in 5.0.0
39+
*
40+
* @var null|string
41+
*/
3642
public static $defaultName = 'mezzio:swoole:stop';
3743

3844
/**

test/Command/ReloadCommandTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function testExecuteEndsWithErrorWhenStopCommandFails(): void
149149
->willReturn(1);
150150

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

154154
$command->setApplication($application);
155155

@@ -200,8 +200,8 @@ public function testExecuteEndsWithErrorWhenStartCommandFails(): void
200200
->expects($this->exactly(2))
201201
->method('find')
202202
->willReturnMap([
203-
[StopCommand::$defaultName, $stopCommand],
204-
[StartCommand::$defaultName, $startCommand],
203+
[StopCommand::getDefaultName(), $stopCommand],
204+
[StartCommand::getDefaultName(), $startCommand],
205205
]);
206206

207207
$command->setApplication($application);
@@ -270,8 +270,8 @@ public function testExecuteEndsWithSuccessWhenBothStopAndStartCommandsSucceed():
270270
->expects($this->exactly(2))
271271
->method('find')
272272
->willReturnMap([
273-
[StopCommand::$defaultName, $stopCommand],
274-
[StartCommand::$defaultName, $startCommand],
273+
[StopCommand::getDefaultName(), $stopCommand],
274+
[StartCommand::getDefaultName(), $startCommand],
275275
]);
276276

277277
$this->output

0 commit comments

Comments
 (0)