Php cs fixes

This commit is contained in:
2024-08-12 15:52:21 +02:00
committed by Julien Fastré
parent 35199b6993
commit 5d84e997c1
5 changed files with 62 additions and 26 deletions

View File

@@ -1,5 +1,14 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Service\Workflow;
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
@@ -12,9 +21,7 @@ use Symfony\Component\Workflow\Registry;
#[AsMessageHandler]
class CancelStaleWorkflowHandler
{
public function __construct(private readonly EntityWorkflowRepository $workflowRepository, private readonly Registry $registry, private EntityManagerInterface $em, private LoggerInterface $logger)
{
}
public function __construct(private readonly EntityWorkflowRepository $workflowRepository, private readonly Registry $registry, private EntityManagerInterface $em, private LoggerInterface $logger) {}
public function __invoke(CancelStaleWorkflow $message): void
{
@@ -28,7 +35,7 @@ class CancelStaleWorkflowHandler
$transitionApplied = false;
if (count($steps) === 1) {
if (1 === count($steps)) {
$this->em->remove($workflow->getCurrentStep());
$this->em->remove($workflow);
} else {
@@ -46,12 +53,8 @@ class CancelStaleWorkflowHandler
if (!$transitionApplied) {
$this->logger->error(sprintf('No valid transition found for EntityWorkflow %d.', $workflowId));
throw new UnrecoverableMessageHandlingException(
sprintf('No valid transition found for EntityWorkflow %d.', $workflowId)
);
throw new UnrecoverableMessageHandlingException(sprintf('No valid transition found for EntityWorkflow %d.', $workflowId));
}
}
}
}