Skip to content

Commit

Permalink
Drop Symfony 4.4 and Twig 2 (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Apr 22, 2023
1 parent 6f02eeb commit 788e381
Show file tree
Hide file tree
Showing 58 changed files with 260 additions and 632 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ jobs:
dependencies: highest
allowed-to-fail: false
variant: sonata-project/block-bundle:"5.x-dev as 4.999"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 4.4.*
variant: symfony/symfony:"4.4.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
Expand Down
44 changes: 22 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
"sonata-project/seo-bundle": "^3.4",
"sonata-project/twig-extensions": "^1.3 || ^2.0",
"symfony-cmf/routing-bundle": "^2.1 || ^3.0",
"symfony/config": "^4.4 || ^5.4 || ^6.2",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4.3 || ^5.4 || ^6.2",
"symfony/form": "^4.4 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.2",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.2",
"symfony/intl": "^4.4 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"symfony/process": "^4.4 || ^5.4 || ^6.2",
"symfony/routing": "^4.4 || ^5.4 || ^6.2",
"symfony/security-core": "^4.4 || ^5.4 || ^6.2",
"symfony/security-http": "^4.4 || ^5.4 || ^6.2",
"symfony/serializer": "^4.4 || ^5.4 || ^6.2",
"symfony/validator": "^4.4 || ^5.4 || ^6.2",
"symfony/config": "^5.4 || ^6.2",
"symfony/console": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/form": "^5.4 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/intl": "^5.4 || ^6.2",
"symfony/options-resolver": "^5.4 || ^6.2",
"symfony/process": "^5.4 || ^6.2",
"symfony/routing": "^5.4 || ^6.2",
"symfony/security-core": "^5.4 || ^6.2",
"symfony/security-http": "^5.4 || ^6.2",
"symfony/serializer": "^5.4 || ^6.2",
"symfony/validator": "^5.4 || ^6.2",
"twig/string-extra": "^3.0",
"twig/twig": "^2.12.1 || ^3.0"
"twig/twig": "^3.0"
},
"require-dev": {
"dama/doctrine-test-bundle": "^7.0",
Expand All @@ -63,14 +63,14 @@
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^4.0 || ^5.0",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.15",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/panther": "^1.0 || ^2.0",
"symfony/browser-kit": "^5.4 || ^6.2",
"symfony/css-selector": "^5.4 || ^6.2",
"symfony/filesystem": "^5.4 || ^6.2",
"symfony/panther": "^2.0.1",
"symfony/phpunit-bridge": "^6.2",
"symfony/yaml": "^4.4 || ^5.4 || ^6.2",
"symfony/yaml": "^5.4 || ^6.2",
"vimeo/psalm": "^4.7.2 || ^5.0"
},
"conflict": {
Expand Down
34 changes: 0 additions & 34 deletions src/CmsManager/BCLogoutHandlerInterface.php

This file was deleted.

5 changes: 4 additions & 1 deletion src/CmsManager/CmsManagerSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @author Thomas Rabaix <[email protected]>
*/
final class CmsManagerSelector implements CmsManagerSelectorInterface, BCLogoutHandlerInterface
final class CmsManagerSelector implements CmsManagerSelectorInterface
{
/**
* @param AdminInterface<PageInterface> $pageAdmin
Expand Down Expand Up @@ -75,6 +75,9 @@ public function onSecurityInteractiveLogin(InteractiveLoginEvent $event): void
}
}

/**
* NEXT_MAJOR: Remove this method.
*/
public function logout(Request $request, Response $response, TokenInterface $token): void
{
if ($request->hasSession()) {
Expand Down
5 changes: 1 addition & 4 deletions src/CmsManager/DecoratorStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public function __construct(

public function isDecorable(Request $request, int $requestType, Response $response): bool
{
// TODO: Simplify this when dropping support for Symfony < 5.3
$mainRequestType = \defined(HttpKernelInterface::class.'::MAIN_REQUEST') ? HttpKernelInterface::MAIN_REQUEST : 1;

if ($mainRequestType !== $requestType) {
if (HttpKernelInterface::MAIN_REQUEST !== $requestType) {
return false;
}

Expand Down
8 changes: 0 additions & 8 deletions src/Command/CleanupSnapshotsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
#[AsCommand(name: 'sonata:page:cleanup-snapshots', description: 'Cleanups the deprecated snapshots by a given site')]
final class CleanupSnapshotsCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:cleanup-snapshots';
protected static $defaultDescription = 'Cleanups the deprecated snapshots by a given site';

public function __construct(
private CleanupSnapshotBySiteInterface $cleanupSnapshotBySite,
private SiteManagerInterface $siteManager
Expand All @@ -38,11 +34,7 @@ public function __construct(

public function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('site', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Site id')
->addOption('keep-snapshots', null, InputOption::VALUE_REQUIRED, 'Keep a given count of snapshots per page', 5);
}
Expand Down
8 changes: 0 additions & 8 deletions src/Command/CloneSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
#[AsCommand(name: 'sonata:page:clone-site', description: 'Clone a complete site including all their pages')]
final class CloneSiteCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:clone-site';
protected static $defaultDescription = 'Clone a complete site including all their pages';

public function __construct(
private SiteManagerInterface $siteManager,
private PageManagerInterface $pageManager,
Expand All @@ -45,11 +41,7 @@ public function __construct(

public function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('source-id', 'so', InputOption::VALUE_REQUIRED, 'Source site id')
->addOption('dest-id', 'd', InputOption::VALUE_REQUIRED, 'Destination site id')
->addOption('prefix', 'p', InputOption::VALUE_REQUIRED, 'Title prefix')
Expand Down
8 changes: 0 additions & 8 deletions src/Command/CreateBlockContainerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#[AsCommand(name: 'sonata:page:create-block-container', description: 'Creates a block container in all pages for specified template code')]
final class CreateBlockContainerCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:create-block-container';
protected static $defaultDescription = 'Creates a block container in all pages for specified template code';

public function __construct(
private PageManagerInterface $pageManager,
private BlockInteractorInterface $blockInteractor
Expand All @@ -42,11 +38,7 @@ public function __construct(

protected function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addArgument('templateCode', InputArgument::REQUIRED, 'Template name according to sonata_page.yml (e.g. default)')
->addArgument('blockCode', InputArgument::REQUIRED, 'Block alias (e.g. content_bottom)')
->addArgument('blockName', InputArgument::OPTIONAL, 'Block name (e.g. Bottom container)');
Expand Down
8 changes: 0 additions & 8 deletions src/Command/CreateSiteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@
#[AsCommand(name: 'sonata:page:create-site', description: 'Create a site')]
final class CreateSiteCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:create-site';
protected static $defaultDescription = 'Create a site';

public function __construct(private SiteManagerInterface $siteManager)
{
parent::__construct();
}

public function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('no-confirmation', null, InputOption::VALUE_NONE, 'Ask confirmation before generating the site')
->addOption('enabled', null, InputOption::VALUE_NONE, 'Site.enabled')
->addOption('name', null, InputOption::VALUE_OPTIONAL, 'Site.name')
Expand Down
8 changes: 0 additions & 8 deletions src/Command/CreateSnapshotsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#[AsCommand(name: 'sonata:page:create-snapshots', description: 'Create a snapshots of all pages available')]
final class CreateSnapshotsCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:create-snapshots';
protected static $defaultDescription = 'Create a snapshots of all pages available';

public function __construct(
private CreateSnapshotBySiteInterface $createSnapshot,
private SiteManagerInterface $siteManager
Expand All @@ -43,11 +39,7 @@ public function __construct(

public function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('site', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Site id');
}

Expand Down
8 changes: 0 additions & 8 deletions src/Command/UpdateCoreRoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#[AsCommand(name: 'sonata:page:update-core-routes', description: 'Update core routes, from routing files to page manager')]
final class UpdateCoreRoutesCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:page:update-core-routes';
protected static $defaultDescription = 'Update core routes, from routing files to page manager';

public function __construct(
private SiteManagerInterface $siteManager,
private RoutePageGenerator $pageGenerator
Expand All @@ -43,11 +39,7 @@ public function __construct(

public function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('clean', null, InputOption::VALUE_NONE, 'Removes all unused routes')
->addOption('site', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Site id');
}
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/BlockAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public function savePositionAction(Request $request): Response
$this->admin->checkAccess('savePosition');

try {
// TODO: Change to $request->query->all('filter') when support for Symfony < 5.1 is dropped.
/** @var array<array{id?: int|string, position?: string, parent_id?: int|string, page_id?: int|string}> $params */
$params = $request->request->all()['disposition'] ?? [];
$params = $request->request->all('disposition');

if ([] === $params) {
throw new HttpException(400, 'wrong parameters');
Expand Down
Loading

0 comments on commit 788e381

Please sign in to comment.