From a915c3502604a33b8d090408a5dba5cb29af5b53 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 16 Jan 2025 10:25:02 +0100 Subject: [PATCH] Rector changes --- .../Controller/SocialWorkExportController.php | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php index d79805620..c13969431 100644 --- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php +++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkExportController.php @@ -31,12 +31,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SocialWorkExportController extends AbstractController { public function __construct( - private SocialIssueRepository $socialIssueRepository, - private SocialActionRepository $socialActionRepository, - private Security $security, - private TranslatorInterface $translator, - private SocialIssueRender $socialIssueRender, - private SocialActionRender $socialActionRender, + private readonly SocialIssueRepository $socialIssueRepository, + private readonly SocialActionRepository $socialActionRepository, + private readonly Security $security, + private readonly TranslatorInterface $translator, + private readonly SocialIssueRender $socialIssueRender, + private readonly SocialActionRender $socialActionRender, ) {} /** @@ -53,14 +53,12 @@ class SocialWorkExportController extends AbstractController $socialIssues = $this->socialIssueRepository->findAll(); - $socialIssues = array_map(function ($issue) { - return [ - 'id' => $issue->getId(), - 'title' => $this->socialIssueRender->renderString($issue, []), - 'ordering' => $issue->getOrdering(), - 'desactivationDate' => $issue->getDesactivationDate(), - ]; - }, $socialIssues); + $socialIssues = array_map(fn($issue) => [ + 'id' => $issue->getId(), + 'title' => $this->socialIssueRender->renderString($issue, []), + 'ordering' => $issue->getOrdering(), + 'desactivationDate' => $issue->getDesactivationDate(), + ], $socialIssues); $csv = Writer::createFromPath('php://temp', 'r+'); $csv->insertOne( @@ -108,15 +106,13 @@ class SocialWorkExportController extends AbstractController $socialActions = $this->socialActionRepository->findAll(); - $socialActions = array_map(function ($action) { - return [ - 'id' => $action->getId(), - 'title' => $this->socialActionRender->renderString($action, []), - 'desactivationDate' => $action->getDesactivationDate(), - 'socialIssue' => $this->socialIssueRender->renderString($action->getIssue(), []), - 'ordering' => $action->getOrdering(), - ]; - }, $socialActions); + $socialActions = array_map(fn($action) => [ + 'id' => $action->getId(), + 'title' => $this->socialActionRender->renderString($action, []), + 'desactivationDate' => $action->getDesactivationDate(), + 'socialIssue' => $this->socialIssueRender->renderString($action->getIssue(), []), + 'ordering' => $action->getOrdering(), + ], $socialActions); $csv = Writer::createFromPath('php://temp', 'r+'); $csv->insertOne(