Skip to content

Commit 985fe5d

Browse files
authored
Add support for symfony/console of version ^7.0 (#189)
1 parent 8ea90e6 commit 985fe5d

File tree

6 files changed

+9
-24
lines changed

6 files changed

+9
-24
lines changed

.phpunit-watcher.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 2.1.2 under development
44

5-
- no changes in this release.
5+
- Enh #189: Add support for `symfony/console` of version `^7.0` (@vjik)
66

77
## 2.1.1 November 05, 2023
88

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"psr/container": "^1.0|^2.0",
3232
"psr/event-dispatcher": "^1.0",
3333
"psr/log": "^1.0|^2.0|^3.0",
34-
"symfony/console": "^5.4|^6.0",
34+
"symfony/console": "^5.4|^6.0|^7.0",
3535
"symfony/event-dispatcher-contracts": "^2.2|^3.0",
3636
"yiisoft/friendly-exception": "^1.0"
3737
},
@@ -40,7 +40,6 @@
4040
"phpunit/phpunit": "^9.5",
4141
"rector/rector": "^0.18.0",
4242
"roave/infection-static-analysis-plugin": "^1.16",
43-
"spatie/phpunit-watcher": "^1.23",
4443
"vimeo/psalm": "^4.30|^5.6",
4544
"yiisoft/config": "^1.3",
4645
"yiisoft/di": "^1.2",

src/Command/Game.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yiisoft\Yii\Console\Command;
66

7+
use Symfony\Component\Console\Attribute\AsCommand;
78
use Symfony\Component\Console\Command\Command;
89
use Symfony\Component\Console\Helper\QuestionHelper;
910
use Symfony\Component\Console\Input\InputInterface;
@@ -14,11 +15,9 @@
1415
/**
1516
* @codeCoverageIgnore
1617
*/
18+
#[AsCommand('|yii', 'A Guessing Game')]
1719
final class Game extends Command
1820
{
19-
protected static $defaultName = '|yii';
20-
protected static $defaultDescription = 'A Guessing Game';
21-
2221
protected function execute(InputInterface $input, OutputInterface $output): int
2322
{
2423
$steps = 1;

src/Command/Serve.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yiisoft\Yii\Console\Command;
66

7+
use Symfony\Component\Console\Attribute\AsCommand;
78
use Symfony\Component\Console\Command\Command;
89
use Symfony\Component\Console\Completion\CompletionInput;
910
use Symfony\Component\Console\Completion\CompletionSuggestions;
@@ -21,6 +22,7 @@
2122
use function is_dir;
2223
use function passthru;
2324

25+
#[AsCommand('serve', 'Runs PHP built-in web server')]
2426
final class Serve extends Command
2527
{
2628
public const EXIT_CODE_NO_DOCUMENT_ROOT = 2;
@@ -33,9 +35,6 @@ final class Serve extends Command
3335
private string $defaultRouter;
3436
private int $defaultWorkers;
3537

36-
protected static $defaultName = 'serve';
37-
protected static $defaultDescription = 'Runs PHP built-in web server';
38-
3938
/**
4039
* @psalm-param array{
4140
* address?:non-empty-string,

tests/Stub/ErrorCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44

55
namespace Yiisoft\Yii\Console\Tests\Stub;
66

7+
use Symfony\Component\Console\Attribute\AsCommand;
78
use Symfony\Component\Console\Command\Command;
89
use Symfony\Component\Console\Input\InputInterface;
910
use Symfony\Component\Console\Output\OutputInterface;
1011
use Yiisoft\Yii\Console\ExitCode;
1112

13+
#[AsCommand('error', 'Error command tests')]
1214
final class ErrorCommand extends Command
1315
{
14-
protected static $defaultName = 'error';
15-
protected static $defaultDescription = 'Error command tests';
16-
1716
public function __construct(private NonExistsClass $class)
1817
{
1918
parent::__construct();
2019
}
2120

22-
protected function execute(InputInterface $input, OutputInterface $output)
21+
protected function execute(InputInterface $input, OutputInterface $output): int
2322
{
2423
return ExitCode::OK;
2524
}

0 commit comments

Comments
 (0)