From 7e1a9bd667f0f688e4c1c2f5509018a7f8c5e03e Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 22 Jan 2024 10:40:28 +0100 Subject: [PATCH] Solve psalm issues --- src/Controller/CRUDController.php | 4 ++-- .../Compiler/AddDependencyCallsCompilerPass.php | 6 +++--- src/DependencyInjection/Compiler/ExtensionCompilerPass.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Controller/CRUDController.php b/src/Controller/CRUDController.php index c093b4cd3e..bafdc3b3d8 100644 --- a/src/Controller/CRUDController.php +++ b/src/Controller/CRUDController.php @@ -470,14 +470,14 @@ public function batchAction(Request $request): Response $nonRelevantMessage = 0 !== \count($idx) || $allElements; // at least one item is selected } - if (!$nonRelevantMessage) { // default non relevant message (if false of null) + if (!\is_string($nonRelevantMessage) && true !== $nonRelevantMessage) { // default non relevant message $nonRelevantMessage = 'flash_batch_empty'; } $datagrid = $this->admin->getDatagrid(); $datagrid->buildPager(); - if (true !== $nonRelevantMessage) { + if (\is_string($nonRelevantMessage)) { $this->addFlash( 'sonata_flash_info', $this->trans($nonRelevantMessage, [], 'SonataAdminBundle') diff --git a/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php b/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php index 275d05566c..b6b56cf941 100644 --- a/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php +++ b/src/DependencyInjection/Compiler/AddDependencyCallsCompilerPass.php @@ -202,8 +202,8 @@ public function process(ContainerBuilder $container): void 'priority' => $attributes['priority'] ?? 0, ]; - if (isset($groupDefaults[$resolvedGroupName]['on_top']) && $groupDefaults[$resolvedGroupName]['on_top'] - || $onTop && (\count($groupDefaults[$resolvedGroupName]['items']) > 1)) { + if (isset($groupDefaults[$resolvedGroupName]['on_top']) && true === $groupDefaults[$resolvedGroupName]['on_top'] + || true === $onTop && (\count($groupDefaults[$resolvedGroupName]['items']) > 1)) { throw new \RuntimeException('You can\'t use "on_top" option with multiple same name groups.'); } $groupDefaults[$resolvedGroupName]['on_top'] = $onTop; @@ -271,7 +271,7 @@ public function process(ContainerBuilder $container): void if ( isset($groups[$resolvedGroupName]['on_top']) - && ($group['on_top'] ?? false) + && true === ($group['on_top'] ?? false) && \count($groups[$resolvedGroupName]['items']) > 1 ) { throw new \RuntimeException('You can\'t use "on_top" option with multiple same name groups.'); diff --git a/src/DependencyInjection/Compiler/ExtensionCompilerPass.php b/src/DependencyInjection/Compiler/ExtensionCompilerPass.php index b2b079267e..14d7791e85 100644 --- a/src/DependencyInjection/Compiler/ExtensionCompilerPass.php +++ b/src/DependencyInjection/Compiler/ExtensionCompilerPass.php @@ -88,7 +88,7 @@ public function process(ContainerBuilder $container): void } $universalExtensions[$id][] = $attributes; - if (!$target || !$container->hasDefinition($target)) { + if (false === $target || !$container->hasDefinition($target)) { continue; }