Skip to content

Commit

Permalink
Drop support for Symfony 4 and Twig 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Apr 24, 2023
1 parent 67ecd1c commit a29d219
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 49 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/test.yaml
Expand Up @@ -42,11 +42,6 @@ jobs:
dependencies: lowest
allowed-to-fail: false
variant: normal
- 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
26 changes: 13 additions & 13 deletions composer.json
Expand Up @@ -24,14 +24,14 @@
"ext-json": "*",
"sonata-project/block-bundle": "^4.18",
"sonata-project/exporter": "^2.0 || ^3.0",
"symfony/config": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4 || ^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.13 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"twig/twig": "^2.9 || ^3.0"
"symfony/config": "^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/options-resolver": "^5.4 || ^6.2",
"twig/twig": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4",
Expand All @@ -45,12 +45,12 @@
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.18",
"rector/rector": "^0.15",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/finder": "^4.4 || ^5.4 || ^6.2",
"symfony/console": "^5.4 || ^6.2",
"symfony/filesystem": "^5.4 || ^6.2",
"symfony/finder": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^6.2",
"symfony/yaml": "^4.4 || ^5.4 || ^6.2",
"vimeo/psalm": "^4.7.2 || ^5.0"
"symfony/yaml": "^5.4 || ^6.2",
"vimeo/psalm": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 0 additions & 8 deletions src/Command/SitemapGeneratorCommand.php
Expand Up @@ -36,10 +36,6 @@
#[AsCommand(name: 'sonata:seo:sitemap', description: 'Create a sitemap')]
final class SitemapGeneratorCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:seo:sitemap';
protected static $defaultDescription = 'Create a sitemap';

public function __construct(
private RouterInterface $router,
private SourceManager $sitemapManager,
Expand All @@ -50,11 +46,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)
->setHelp(<<<'EOT'
The <info>sonata:seo:sitemap</info> command create new sitemap files (index + sitemap).
EOT)
Expand Down
11 changes: 4 additions & 7 deletions src/Resources/config/blocks.php
Expand Up @@ -11,22 +11,19 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sonata\SeoBundle\Block\Breadcrumb\HomepageBreadcrumbBlockService;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1

$containerConfigurator->services()

->set('sonata.seo.block.breadcrumb.homepage', HomepageBreadcrumbBlockService::class)
->public()
->tag('sonata.block')
->tag('sonata.breadcrumb')
->args([
new ReferenceConfigurator('twig'),
new ReferenceConfigurator('knp_menu.factory'),
service('twig'),
service('knp_menu.factory'),
]);
};
12 changes: 5 additions & 7 deletions src/Resources/config/commands.php
Expand Up @@ -11,20 +11,18 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sonata\SeoBundle\Command\SitemapGeneratorCommand;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$containerConfigurator->services()

->set(SitemapGeneratorCommand::class)
->tag('console.command')
->args([
new ReferenceConfigurator('router'),
new ReferenceConfigurator('sonata.seo.sitemap.manager'),
new ReferenceConfigurator('filesystem'),
service('router'),
service('sonata.seo.sitemap.manager'),
service('filesystem'),
]);
};
5 changes: 2 additions & 3 deletions src/Resources/config/event.php
Expand Up @@ -11,12 +11,11 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sonata\SeoBundle\Event\BreadcrumbListener;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$containerConfigurator->services()

->set('sonata.seo.event.breadcrumb', BreadcrumbListener::class)
Expand Down
10 changes: 4 additions & 6 deletions src/Resources/config/services.php
Expand Up @@ -11,15 +11,13 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sonata\SeoBundle\Seo\SeoPage;
use Sonata\SeoBundle\Sitemap\SourceManager;
use Sonata\SeoBundle\Twig\Extension\SeoExtension;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Loader\Configurator\ReferenceConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
// Use "service" function for creating references to services when dropping support for Symfony 4.4
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$containerConfigurator->services()

->set('sonata.seo.page.default', SeoPage::class)
Expand All @@ -28,8 +26,8 @@
->set('sonata.seo.twig.extension', SeoExtension::class)
->tag('twig.extension')
->args([
new ReferenceConfigurator('sonata.seo.page'),
'',
service('sonata.seo.page'),
abstract_arg('encoding'),
])

->set('sonata.seo.sitemap.manager', SourceManager::class);
Expand Down

0 comments on commit a29d219

Please sign in to comment.