Skip to content

Commit 435ab04

Browse files
committed
fixes for Sylius 2.0
1 parent 9131bc3 commit 435ab04

29 files changed

+104
-34
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
-
153153
name: Update Webpack version
154154
if: matrix.sylius == '~2.0.0'
155-
run: composer require "symfony/webpack-encore-bundle:^2.0" --no-update --no-scripts --no-interaction
155+
run: composer require "symfony/webpack-encore-bundle:^2.0" "nyholm/psr7:^1.8" --no-update --no-scripts --no-interaction
156156

157157
-
158158
name: Remove FOS OAuth Server

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"require": {
1111
"php": ">=8.1",
12-
"sylius/sylius": "^1.11||^2.0"
12+
"sylius/sylius": "^2.0"
1313
},
1414
"require-dev": {
1515
"behat/behat": "^3.6.1",
@@ -25,7 +25,6 @@
2525
"friends-of-behat/suite-settings-extension": "^1.0",
2626
"friends-of-behat/symfony-extension": "^2.1",
2727
"friends-of-behat/variadic-extension": "^1.3",
28-
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
2928
"phpstan/extension-installer": "^1.0",
3029
"phpstan/phpstan": "^1.8.4",
3130
"phpstan/phpstan-doctrine": "^1.3.12",
@@ -46,7 +45,8 @@
4645
"allow-plugins": {
4746
"symfony/thanks": false,
4847
"dealerdirect/phpcodesniffer-composer-installer": false,
49-
"phpstan/extension-installer": false
48+
"phpstan/extension-installer": false,
49+
"php-http/discovery": false
5050
}
5151
},
5252
"extra": {

tests/Application/Command/CommandWithContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010

1111
use JbDevLabs\SyliusCliContextPlugin\Command\CliContextAwareInterface;
1212
use Sylius\Component\Channel\Context\ChannelContextInterface;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617

18+
#[AsCommand(name: 'app:command-with-context')]
1719
final class CommandWithContext extends Command implements CliContextAwareInterface
1820
{
1921
protected static $defaultName = 'app:command-with-context';
20-
private ChannelContextInterface $channelContext;
2122

22-
public function __construct(ChannelContextInterface $channelContext)
23+
public function __construct(private readonly ChannelContextInterface $channelContext)
2324
{
2425
parent::__construct();
25-
$this->channelContext = $channelContext;
2626
}
2727

28-
protected function execute(InputInterface $input, OutputInterface $output)
28+
protected function execute(InputInterface $input, OutputInterface $output): int
2929
{
3030
$channel = $this->channelContext->getChannel();
3131
$output->writeln('Channel name: ' . $channel->getName());

tests/Application/Command/CommandWithoutContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010

1111
use Sylius\Component\Channel\Context\ChannelContextInterface;
1212
use Sylius\Component\Channel\Context\ChannelNotFoundException;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617

18+
#[AsCommand('app:command-without-context')]
1719
final class CommandWithoutContext extends Command
1820
{
1921
protected static $defaultName = 'app:command-without-context';
20-
private ChannelContextInterface $channelContext;
2122

22-
public function __construct(ChannelContextInterface $channelContext)
23+
public function __construct(private readonly ChannelContextInterface $channelContext)
2324
{
2425
parent::__construct();
25-
$this->channelContext = $channelContext;
2626
}
2727

28-
protected function execute(InputInterface $input, OutputInterface $output)
28+
protected function execute(InputInterface $input, OutputInterface $output): int
2929
{
3030
try {
3131
$channel = $this->channelContext->getChannel();

tests/Application/Command/LoadChannelManuallyCommand.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,30 @@
1111

1212
use JbDevLabs\SyliusCliContextPlugin\CliContext\CliChannelContext;
1313
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
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\Input\InputOption;
1718
use Symfony\Component\Console\Output\OutputInterface;
1819

20+
#[AsCommand('app:change-channel')]
1921
final class LoadChannelManuallyCommand extends Command
2022
{
2123
protected static $defaultName = 'app:change-channel';
22-
private CliChannelContext $channelContext;
23-
private ChannelRepositoryInterface $channelRepository;
2424

25-
public function __construct(CliChannelContext $channelContext, ChannelRepositoryInterface $channelRepository)
25+
public function __construct(private readonly CliChannelContext $channelContext, private readonly ChannelRepositoryInterface $channelRepository)
2626
{
2727
parent::__construct();
28-
$this->channelContext = $channelContext;
29-
$this->channelRepository = $channelRepository;
3028
}
3129

32-
protected function configure()
30+
protected function configure(): void
3331
{
3432
$this->addOption('channel', 'c', InputOption::VALUE_REQUIRED, 'Channel code to use durring the running command',
3533
null);
3634
}
3735

3836

39-
protected function execute(InputInterface $input, OutputInterface $output)
37+
protected function execute(InputInterface $input, OutputInterface $output): int
4038
{
4139
$channel = $input->getOption('channel');
4240

tests/Application/Command/OtherCommand.php

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

1111

1212
use Sylius\Component\Channel\Context\ChannelContextInterface;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617

18+
#[AsCommand('app:other-command')]
1719
final class OtherCommand extends Command
1820
{
1921
protected static $defaultName = 'app:other-command';
2022

21-
public function __construct(ChannelContextInterface $channelContext)
23+
public function __construct(private readonly ChannelContextInterface $channelContext)
2224
{
2325
parent::__construct();
24-
$this->channelContext = $channelContext;
2526
}
2627

27-
protected function execute(InputInterface $input, OutputInterface $output)
28+
protected function execute(InputInterface $input, OutputInterface $output): int
2829
{
2930
$channel = $this->channelContext->getChannel();
3031
$output->writeln('Channel name: ' . $channel->getName());

tests/Application/Kernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function getContainerBaseClass(): string
7777

7878
private function isTestEnvironment(): bool
7979
{
80-
return 0 === strpos($this->getEnvironment(), 'test');
80+
return str_starts_with($this->getEnvironment(), 'test');
8181
}
8282

8383
private function loadContainerConfiguration(LoaderInterface $loader, string $confDir): void
@@ -96,7 +96,7 @@ private function loadRoutesConfiguration(RoutingConfigurator $routes, string $co
9696
}
9797

9898
/**
99-
* @return BundleInterface[]
99+
* @return iterable<BundleInterface>
100100
*/
101101
private function registerBundlesFromFile(string $bundlesFile): iterable
102102
{
@@ -109,7 +109,7 @@ private function registerBundlesFromFile(string $bundlesFile): iterable
109109
}
110110

111111
/**
112-
* @return string[]
112+
* @return iterable<string>
113113
*/
114114
private function getConfigurationDirectories(): iterable
115115
{

tests/Application/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"name": "pocky/modern-plugin-skeleton-test-application",
33
"description": "Sylius application for modern plugin testing purposes (composer.json needed for project dir resolving)",
4-
"license": "MIT"
4+
"license": "MIT",
5+
"require": {
6+
"nyholm/psr7": "^1.8"
7+
}
58
}

tests/Application/config/bundles.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
4545
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
4646
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true],
47-
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
4847
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
4948
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
5049
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],

tests/Application/config/routes/sylius_shop.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ sylius_shop:
44
requirements:
55
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
66

7-
sylius_shop_payum:
8-
resource: "@SyliusShopBundle/Resources/config/routing/payum.yml"
9-
107
sylius_shop_default_locale:
118
path: /
129
methods: [GET]

0 commit comments

Comments
 (0)