From 5a66b64a226e584f0f633afdfaa92943628f34c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20B=C5=82oszyk?= Date: Mon, 20 Jul 2020 10:18:03 +0200 Subject: [PATCH] Add support for SonataBlockBundle 4.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update UPGRADE-3.x.md Co-authored-by: Grégoire Paris --- UPGRADE-3.x.md | 7 +++++++ composer.json | 2 +- src/Block/AuditBlockService.php | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/UPGRADE-3.x.md b/UPGRADE-3.x.md index c12eb68ae..e36373927 100644 --- a/UPGRADE-3.x.md +++ b/UPGRADE-3.x.md @@ -4,6 +4,13 @@ UPGRADE 3.x UPGRADE FROM 3.x to 3.x ========================= +### Compatibility with SonataBlockBundle 4.0 + +We added compatibility with SonataBlockBundle 4.0, make sure you are explicitly declaring your dependency +with `sonata-project/block-bundle` on your composer.json in order to avoid unwanted upgrades. + +There is a minimal BC Break on `AuditBlockService`. If you are extending this class (keep in mind that it will become final on 4.0) you should add return type hints to `execute()` and `configureSettings()`. + ### Sonata\DoctrineORMAdminBundle\Model\ModelManager Deprecated `camelize()` method with no replacement. diff --git a/composer.json b/composer.json index 631dbdd82..dfc07612c 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ }, "require-dev": { "simplethings/entity-audit-bundle": "^0.9 || ^1.0", - "sonata-project/block-bundle": "^3.17", + "sonata-project/block-bundle": "^3.17 || ^4.0", "symfony/phpunit-bridge": "^5.0" }, "suggest": { diff --git a/src/Block/AuditBlockService.php b/src/Block/AuditBlockService.php index 18c45bd03..e111bb571 100644 --- a/src/Block/AuditBlockService.php +++ b/src/Block/AuditBlockService.php @@ -24,6 +24,8 @@ use Twig\Environment; /** + * @final since sonata-project/doctrine-orm-admin-bundle 3.x + * * @author Thomas Rabaix */ class AuditBlockService extends AbstractBlockService @@ -92,7 +94,7 @@ public function __construct($templatingOrDeprecatedName, object $templatingOrAud } } - public function execute(BlockContextInterface $blockContext, ?Response $response = null) + public function execute(BlockContextInterface $blockContext, ?Response $response = null): Response { $revisions = []; @@ -119,7 +121,7 @@ public function getName() return 'Audit List'; } - public function configureSettings(OptionsResolver $resolver) + public function configureSettings(OptionsResolver $resolver): void { $resolver->setDefaults([ 'limit' => 10,