Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -20,9 +20,8 @@ class AdminController extends AbstractController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document", name="chill_docstore_admin", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document', name: 'chill_docstore_admin', options: [null])]
public function indexAction()
{
return $this->render('@ChillDocStore/Admin/layout.html.twig');
@@ -30,9 +29,8 @@ class AdminController extends AbstractController
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document_redirect_to_main", name="chill_docstore_admin_redirect_to_admin_index", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document_redirect_to_main', name: 'chill_docstore_admin_redirect_to_admin_index', options: [null])]
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@@ -33,10 +33,7 @@ final readonly class AsyncUploadController
private LoggerInterface $logger,
) {}
/**
* @Route("/asyncupload/temp_url/generate/{method}",
* name="async_upload.generate_url")
*/
#[Route(path: '/asyncupload/temp_url/generate/{method}', name: 'async_upload.generate_url')]
public function getSignedUrl(string $method, Request $request): JsonResponse
{
try {

View File

@@ -25,9 +25,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @Route("/{_locale}/parcours/{course}/document")
*/
#[Route(path: '/{_locale}/parcours/{course}/document')]
class DocumentAccompanyingCourseController extends AbstractController
{
/**
@@ -40,9 +38,7 @@ class DocumentAccompanyingCourseController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete")
*/
#[Route(path: '/{id}/delete', name: 'chill_docstore_accompanying_course_document_delete')]
public function delete(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::DELETE, $document);
@@ -75,9 +71,7 @@ class DocumentAccompanyingCourseController extends AbstractController
);
}
/**
* @Route("/{id}/edit", name="accompanying_course_document_edit", methods="GET|POST")
*/
#[Route(path: '/{id}/edit', name: 'accompanying_course_document_edit', methods: 'GET|POST')]
public function edit(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::UPDATE, $document);
@@ -116,9 +110,7 @@ class DocumentAccompanyingCourseController extends AbstractController
);
}
/**
* @Route("/new", name="accompanying_course_document_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'accompanying_course_document_new', methods: 'GET|POST')]
public function new(Request $request, AccompanyingPeriod $course): Response
{
if (null === $course) {
@@ -162,9 +154,7 @@ class DocumentAccompanyingCourseController extends AbstractController
]);
}
/**
* @Route("/{id}", name="accompanying_course_document_show", methods="GET")
*/
#[Route(path: '/{id}', name: 'accompanying_course_document_show', methods: 'GET')]
public function show(AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE_DETAILS, $document);

View File

@@ -20,16 +20,12 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/{_locale}/admin/document/category")
*/
#[Route(path: '/{_locale}/admin/document/category')]
class DocumentCategoryController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_delete', methods: 'DELETE')]
public function delete(Request $request, mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();
@@ -47,9 +43,7 @@ class DocumentCategoryController extends AbstractController
return $this->redirectToRoute('document_category_index');
}
/**
* @Route("/{bundleId}/{idInsideBundle}/edit", name="document_category_edit", methods="GET|POST")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}/edit', name: 'document_category_edit', methods: 'GET|POST')]
public function edit(Request $request, mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();
@@ -76,9 +70,8 @@ class DocumentCategoryController extends AbstractController
]);
}
/**
* @Route("/", name="document_category_index", methods="GET")
* @Route("/", name="chill_docstore_category_admin", methods="GET") */
#[Route(path: '/', name: 'document_category_index', methods: 'GET')]
#[Route(path: '/', name: 'chill_docstore_category_admin', methods: 'GET')]
public function index(): Response
{
$em = $this->managerRegistry->getManager();
@@ -92,9 +85,7 @@ class DocumentCategoryController extends AbstractController
);
}
/**
* @Route("/new", name="document_category_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'document_category_new', methods: 'GET|POST')]
public function new(Request $request): Response
{
$em = $this->managerRegistry->getManager();
@@ -130,9 +121,7 @@ class DocumentCategoryController extends AbstractController
]);
}
/**
* @Route("/{bundleId}/{idInsideBundle}", name="document_category_show", methods="GET")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_show', methods: 'GET')]
public function show(mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();

View File

@@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Class DocumentPersonController.
*
* @Route("/{_locale}/person/{person}/document")
*
* TODO faire un controller abstrait ?
*/
#[Route(path: '/{_locale}/person/{person}/document')] // TODO faire un controller abstrait ?
class DocumentPersonController extends AbstractController
{
/**
@@ -46,9 +43,7 @@ class DocumentPersonController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @Route("/{id}/delete", name="chill_docstore_person_document_delete")
*/
#[Route(path: '/{id}/delete', name: 'chill_docstore_person_document_delete')]
public function delete(Request $request, Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted(PersonDocumentVoter::DELETE, $document);
@@ -81,9 +76,7 @@ class DocumentPersonController extends AbstractController
);
}
/**
* @Route("/{id}/edit", name="person_document_edit", methods="GET|POST")
*/
#[Route(path: '/{id}/edit', name: 'person_document_edit', methods: 'GET|POST')]
public function edit(Request $request, Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
@@ -140,9 +133,7 @@ class DocumentPersonController extends AbstractController
);
}
/**
* @Route("/new", name="person_document_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'person_document_new', methods: 'GET|POST')]
public function new(Request $request, Person $person): Response
{
if (null === $person) {
@@ -188,9 +179,7 @@ class DocumentPersonController extends AbstractController
]);
}
/**
* @Route("/{id}", name="person_document_show", methods="GET")
*/
#[Route(path: '/{id}', name: 'person_document_show', methods: 'GET')]
public function show(Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);

View File

@@ -33,9 +33,8 @@ final readonly class GenericDocForAccompanyingPeriodController
/**
* @throws \Doctrine\DBAL\Exception
*
* @Route("/{_locale}/doc-store/generic-doc/by-period/{id}/index", name="chill_docstore_generic-doc_by-period_index")
*/
#[Route(path: '/{_locale}/doc-store/generic-doc/by-period/{id}/index', name: 'chill_docstore_generic-doc_by-period_index')]
public function list(AccompanyingPeriod $accompanyingPeriod): Response
{
if (!$this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod)) {

View File

@@ -33,9 +33,8 @@ final readonly class GenericDocForPerson
/**
* @throws \Doctrine\DBAL\Exception
*
* @Route("/{_locale}/doc-store/generic-doc/by-person/{id}/index", name="chill_docstore_generic-doc_by-person_index")
*/
#[Route(path: '/{_locale}/doc-store/generic-doc/by-person/{id}/index', name: 'chill_docstore_generic-doc_by-person_index')]
public function list(Person $person): Response
{
if (!$this->security->isGranted(PersonDocumentVoter::SEE, $person)) {

View File

@@ -22,9 +22,7 @@ class StoredObjectApiController
{
public function __construct(private readonly Security $security) {}
/**
* @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready")
*/
#[Route(path: '/api/1.0/doc-store/stored-object/{uuid}/is-ready')]
public function isDocumentReady(StoredObject $storedObject): Response
{
if (!$this->security->isGranted('ROLE_USER')) {