Skip to content

Commit 039764d

Browse files
5.1.1 (#1216)
1 parent a9a2f68 commit 039764d

File tree

18 files changed

+46
-42
lines changed

18 files changed

+46
-42
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [5.1.1](https://github.com/sonata-project/SonataBlockBundle/compare/5.1.0...5.1.1) - 2024-10-18
6+
### Fixed
7+
- [[#1212](https://github.com/sonata-project/SonataBlockBundle/pull/1212)] Symfony 7.1 deprecation about `Symfony\Component\HttpKernel\DependencyInjection\Extension` usage ([@VincentLanglet](https://github.com/VincentLanglet))
8+
59
## [5.1.0](https://github.com/sonata-project/SonataBlockBundle/compare/5.0.1...5.1.0) - 2023-11-23
610
### Added
711
- [[#1193](https://github.com/sonata-project/SonataBlockBundle/pull/1193)] Symfony 7 support ([@VincentLanglet](https://github.com/VincentLanglet))

src/Block/BlockContext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class BlockContext implements BlockContextInterface
2222
*/
2323
public function __construct(
2424
private BlockInterface $block,
25-
private array $settings = []
25+
private array $settings = [],
2626
) {
2727
}
2828

@@ -39,7 +39,7 @@ public function getSettings(): array
3939
public function getSetting(string $name): mixed
4040
{
4141
if (!\array_key_exists($name, $this->settings)) {
42-
throw new \RuntimeException(sprintf('Unable to find the option `%s` (%s) - define the option in the related BlockServiceInterface', $name, $this->block->getType() ?? ''));
42+
throw new \RuntimeException(\sprintf('Unable to find the option `%s` (%s) - define the option in the related BlockServiceInterface', $name, $this->block->getType() ?? ''));
4343
}
4444

4545
return $this->settings[$name];
@@ -48,7 +48,7 @@ public function getSetting(string $name): mixed
4848
public function setSetting(string $name, mixed $value): BlockContextInterface
4949
{
5050
if (!\array_key_exists($name, $this->settings)) {
51-
throw new \RuntimeException(sprintf('It\'s not possible add non existing setting `%s`.', $name));
51+
throw new \RuntimeException(\sprintf('It\'s not possible add non existing setting `%s`.', $name));
5252
}
5353

5454
$this->settings[$name] = $value;

src/Block/BlockContextManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class BlockContextManager implements BlockContextManagerInterface
3939
public function __construct(
4040
private BlockLoaderInterface $blockLoader,
4141
private BlockServiceManagerInterface $blockService,
42-
?LoggerInterface $logger = null
42+
?LoggerInterface $logger = null,
4343
) {
4444
$this->logger = $logger ?? new NullLogger();
4545
}
@@ -87,7 +87,7 @@ public function get($meta, array $settings = []): BlockContextInterface
8787
try {
8888
$settings = $this->resolve($block, array_merge($block->getSettings(), $settings));
8989
} catch (ExceptionInterface $e) {
90-
$this->logger->error(sprintf(
90+
$this->logger->error(\sprintf(
9191
'[cms::blockContext] block.id=%s - error while resolving options - %s',
9292
$block->getId() ?? '',
9393
$e->getMessage()

src/Block/BlockLoaderChain.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function exists(string $type): bool
4444
public function load($configuration): BlockInterface
4545
{
4646
if (!\is_string($configuration) && !\is_array($configuration)) {
47-
throw new \TypeError(sprintf(
47+
throw new \TypeError(\sprintf(
4848
'Argument 1 passed to %s must be of type string or array, %s given',
4949
__METHOD__,
5050
\gettype($configuration)
@@ -63,7 +63,7 @@ public function load($configuration): BlockInterface
6363
public function support($configuration): bool
6464
{
6565
if (!\is_string($configuration) && !\is_array($configuration)) {
66-
throw new \TypeError(sprintf(
66+
throw new \TypeError(\sprintf(
6767
'Argument 1 passed to %s must be of type string or array, %s given',
6868
__METHOD__,
6969
\gettype($configuration)

src/Block/BlockRenderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class BlockRenderer implements BlockRendererInterface
2525
public function __construct(
2626
private BlockServiceManagerInterface $blockServiceManager,
2727
private StrategyManagerInterface $exceptionStrategyManager,
28-
private ?LoggerInterface $logger = null
28+
private ?LoggerInterface $logger = null,
2929
) {
3030
}
3131

@@ -35,7 +35,7 @@ public function render(BlockContextInterface $blockContext, ?Response $response
3535

3636
if (null !== $this->logger) {
3737
$this->logger->info(
38-
sprintf('[cms::renderBlock] block.id=%d, block.type=%s', $block->getId() ?? '', $block->getType() ?? '')
38+
\sprintf('[cms::renderBlock] block.id=%d, block.type=%s', $block->getId() ?? '', $block->getType() ?? '')
3939
);
4040
}
4141

@@ -46,7 +46,7 @@ public function render(BlockContextInterface $blockContext, ?Response $response
4646
$response = $service->execute($blockContext, $response ?? new Response());
4747
} catch (\Throwable $exception) {
4848
if (null !== $this->logger) {
49-
$this->logger->error(sprintf(
49+
$this->logger->error(\sprintf(
5050
'[cms::renderBlock] block.id=%d - error while rendering block - %s',
5151
$block->getId() ?? '',
5252
$exception->getMessage()

src/Block/BlockServiceManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class BlockServiceManager implements BlockServiceManagerInterface
3939
*/
4040
public function __construct(
4141
private ContainerInterface $container,
42-
private array $containerTypes
42+
private array $containerTypes,
4343
) {
4444
}
4545

@@ -74,7 +74,7 @@ public function has(string $name): bool
7474
public function add(string $name, $service, array $contexts = []): void
7575
{
7676
if (!\is_string($service) && !$service instanceof BlockServiceInterface) {
77-
throw new \TypeError(sprintf(
77+
throw new \TypeError(\sprintf(
7878
'Argument 2 passed to %s() must be of type string or an object implementing %s, %s given',
7979
__METHOD__,
8080
BlockServiceInterface::class,
@@ -160,13 +160,13 @@ public function validate(ErrorElement $errorElement, BlockInterface $block): voi
160160
private function load(string $type): BlockServiceInterface
161161
{
162162
if (!$this->has($type)) {
163-
throw new BlockServiceNotFoundException(sprintf('The block service `%s` does not exist', $type));
163+
throw new BlockServiceNotFoundException(\sprintf('The block service `%s` does not exist', $type));
164164
}
165165

166166
if (!$this->services[$type] instanceof BlockServiceInterface) {
167167
$blockService = $this->container->get($type);
168168
if (!$blockService instanceof BlockServiceInterface) {
169-
throw new BlockServiceNotFoundException(sprintf('The service %s does not implement BlockServiceInterface', $type));
169+
throw new BlockServiceNotFoundException(\sprintf('The service %s does not implement BlockServiceInterface', $type));
170170
}
171171

172172
$this->services[$type] = $blockService;

src/Block/Loader/ServiceLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function exists(string $type): bool
3939
public function load($configuration): BlockInterface
4040
{
4141
if (!\is_string($configuration) && !\is_array($configuration)) {
42-
throw new \TypeError(sprintf(
42+
throw new \TypeError(\sprintf(
4343
'Argument 1 passed to %s must be of type string or array, %s given',
4444
__METHOD__,
4545
\gettype($configuration)
@@ -53,7 +53,7 @@ public function load($configuration): BlockInterface
5353
}
5454

5555
if (!\in_array($configuration['type'], $this->types, true)) {
56-
throw new \RuntimeException(sprintf(
56+
throw new \RuntimeException(\sprintf(
5757
'The block type "%s" does not exist',
5858
$configuration['type']
5959
));
@@ -73,7 +73,7 @@ public function load($configuration): BlockInterface
7373
public function support($configuration): bool
7474
{
7575
if (!\is_string($configuration) && !\is_array($configuration)) {
76-
throw new \TypeError(sprintf(
76+
throw new \TypeError(\sprintf(
7777
'Argument 1 passed to %s must be of type string or array, %s given',
7878
__METHOD__,
7979
\gettype($configuration)

src/Block/Service/MenuBlockService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class MenuBlockService extends AbstractMenuBlockService
3333
public function __construct(
3434
Environment $twig,
3535
private MenuProviderInterface $menuProvider,
36-
private MenuRegistryInterface $menuRegistry
36+
private MenuRegistryInterface $menuRegistry,
3737
) {
3838
parent::__construct($twig);
3939
}

src/Command/DebugBlocksCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ public function execute(InputInterface $input, OutputInterface $output): int
5151

5252
$title = '';
5353
if ($service instanceof EditableBlockService) {
54-
$title = sprintf(' (<comment>%s</comment>)', $service->getMetadata()->getTitle());
54+
$title = \sprintf(' (<comment>%s</comment>)', $service->getMetadata()->getTitle());
5555
}
56-
$output->writeln(sprintf('<info>>> %s</info>%s', $code, $title));
56+
$output->writeln(\sprintf('<info>>> %s</info>%s', $code, $title));
5757

5858
$resolver = new OptionsResolver();
5959
$service->configureSettings($resolver);
6060

6161
try {
6262
foreach ($resolver->resolve() as $key => $val) {
63-
$output->writeln(sprintf(' %-30s%s', $key, json_encode($val, \JSON_THROW_ON_ERROR)));
63+
$output->writeln(\sprintf(' %-30s%s', $key, json_encode($val, \JSON_THROW_ON_ERROR)));
6464
}
6565
} catch (MissingOptionsException) {
6666
foreach ($resolver->getDefinedOptions() as $option) {
67-
$output->writeln(sprintf(' %s', $option));
67+
$output->writeln(\sprintf(' %s', $option));
6868
}
6969
}
7070
}

src/DependencyInjection/Compiler/TweakCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function process(ContainerBuilder $container): void
6060
foreach ($container->findTaggedServiceIds('knp_menu.menu') as $serviceId => $tags) {
6161
foreach ($tags as $attributes) {
6262
if (!isset($attributes['alias'])) {
63-
throw new \InvalidArgumentException(sprintf('The alias is not defined in the "knp_menu.menu" tag for the service "%s"', $serviceId));
63+
throw new \InvalidArgumentException(\sprintf('The alias is not defined in the "knp_menu.menu" tag for the service "%s"', $serviceId));
6464
}
6565
$registry->addMethodCall('add', [$attributes['alias']]);
6666
}

0 commit comments

Comments
 (0)