Skip to content

Commit

Permalink
Add support for SonataBlockBundle 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wbloszyk committed Jul 20, 2020
1 parent 50974bc commit 972404c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions UPGRADE-3.x.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
UPGRADE 3.x
===========

UPGRADE FROM 3.21 to 3.22
=========================

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 those class (keep in mind that it will become final on 4.0) you should add return type hints to `execute()` and `configureSettings()`.

UPGRADE FROM 3.20 to 3.21
=========================

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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": {
Expand Down
8 changes: 5 additions & 3 deletions src/Block/AuditBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
use Twig\Environment;

/**
* @final since sonata-project/doctrine-orm-admin-bundle 3.x
*
* @author Thomas Rabaix <[email protected]>
*/
class AuditBlockService extends AbstractBlockService
Expand Down Expand Up @@ -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 = [];

Expand All @@ -110,7 +112,7 @@ public function execute(BlockContextInterface $blockContext, ?Response $response
], $response);
}

public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
public function buildEditForm(FormMapper $formMapper, BlockInterface $block): void
{
}

Expand All @@ -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,
Expand Down

0 comments on commit 972404c

Please sign in to comment.