Skip to content

Commit acb3a82

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

File tree

27 files changed

+97
-30
lines changed

27 files changed

+97
-30
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

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/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]

tests/Application/config/sylius/1.11/bundles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
1111
Sylius\Calendar\SyliusCalendarBundle::class => ['all' => true],
1212
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
13+
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
1314
];
File renamed without changes.

0 commit comments

Comments
 (0)