Skip to content

Commit 2cd36f5

Browse files
committed
Sylius 2.0 compatibility
1 parent 79c44b5 commit 2cd36f5

33 files changed

+197
-35
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ $ bin/console doctrine:migrations:diff
6969
$ bin/console doctrine:migrations:migrate
7070
```
7171

72-
### Step 5: Copy template
73-
74-
You can copy the templates under `tests/Application/templates/bundles/SyliusAdminBundle` into your own application to enable the possibility to add an automatic redirection when updating product
75-
76-
### Step 6: Install assets
72+
### Step 5: Install assets
7773
```bash
7874
$ bin/console assets:install
7975
```

ecs.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
declare(strict_types=1);
44

5-
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
6-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
7-
use Symplify\EasyCodingStandard\ValueObject\Option;
5+
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
6+
use Symplify\EasyCodingStandard\Config\ECSConfig;
87

9-
return static function (ContainerConfigurator $containerConfigurator): void {
10-
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
11-
$containerConfigurator->parameters()->set(Option::PATHS, [
12-
'src', 'tests'
8+
return static function (ECSConfig $ecsConfig): void {
9+
$ecsConfig->paths([
10+
__DIR__ . '/src',
11+
__DIR__ . '/tests/',
12+
__DIR__ . '/ecs.php',
1313
]);
14-
$containerConfigurator->parameters()->set(Option::SKIP, [
15-
'tests/Application/**',
14+
15+
$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');
16+
17+
$ecsConfig->skip([
18+
VisibilityRequiredFixer::class => ['*Spec.php'],
1619
]);
1720
};

psalm-baseline.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
3+
</files>

src/EventListener/ControllerSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class ControllerSubscriber implements EventSubscriberInterface, LoggerAwar
3131
public function __construct(
3232
ObjectManager $objectManager,
3333
ChannelContextInterface $channelContext,
34-
RedirectionPathResolverInterface $redirectionPathResolver
34+
RedirectionPathResolverInterface $redirectionPathResolver,
3535
) {
3636
$this->logger = new NullLogger();
3737
$this->objectManager = $objectManager;
@@ -57,7 +57,7 @@ public function onKernelController(ControllerEvent $event): void
5757
}
5858
$redirectionPath = $this->redirectionPathResolver->resolveFromRequest(
5959
$request,
60-
$channel
60+
$channel,
6161
);
6262

6363
if ($redirectionPath->isEmpty()) {

src/EventListener/NotFoundSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class NotFoundSubscriber implements EventSubscriberInterface, LoggerAwareInterfa
3333
public function __construct(
3434
ObjectManager $objectManager,
3535
ChannelContextInterface $channelContext,
36-
RedirectionPathResolverInterface $redirectionPathResolver
36+
RedirectionPathResolverInterface $redirectionPathResolver,
3737
) {
3838
$this->logger = new NullLogger();
3939
$this->objectManager = $objectManager;
@@ -69,7 +69,7 @@ public function onKernelException(ExceptionEvent $event): void
6969
$redirectionPath = $this->redirectionPathResolver->resolveFromRequest(
7070
$request,
7171
$channel,
72-
true
72+
true,
7373
);
7474

7575
if ($redirectionPath->isEmpty()) {

src/EventListener/RedirectResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function getRedirectResponse(RedirectInterface $lastRedirect, stri
2525

2626
return new RedirectResponse(
2727
$uri->__toString(),
28-
$lastRedirect->isPermanent() ? Response::HTTP_MOVED_PERMANENTLY : Response::HTTP_FOUND
28+
$lastRedirect->isPermanent() ? Response::HTTP_MOVED_PERMANENTLY : Response::HTTP_FOUND,
2929
);
3030
}
3131
}

src/Factory/RedirectFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function createNewWithValues(
3131
string $destination,
3232
bool $permanent = true,
3333
bool $only404 = true,
34-
iterable $channels = []
34+
iterable $channels = [],
3535
): RedirectInterface {
3636
$redirect = $this->createNew();
3737

src/Factory/RedirectFactoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public function createNewWithValues(
2020
string $destination,
2121
bool $permanent = true,
2222
bool $only404 = true,
23-
iterable $channels = []
23+
iterable $channels = [],
2424
): RedirectInterface;
2525
}

src/Model/Redirect.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
class Redirect implements RedirectInterface
1616
{
1717
use TimestampableTrait;
18-
1918
use ToggleableTrait;
2019

2120
protected ?int $id = null;

src/Repository/RedirectRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function removeNotAccessed(int $threshold): void
2424
->delete()
2525
->orWhere(
2626
'r.lastAccessed is not null and r.lastAccessed <= :threshold',
27-
'r.lastAccessed is null and r.createdAt <= :threshold'
27+
'r.lastAccessed is null and r.createdAt <= :threshold',
2828
)
2929
->setParameter('threshold', $dateTimeThreshold)
3030
->getQuery()

0 commit comments

Comments
 (0)