From 5eefef13456e3d702b95c6ccb14c11f8d499a69f Mon Sep 17 00:00:00 2001 From: COil Date: Sun, 12 Feb 2023 22:48:47 +0100 Subject: [PATCH] php8: fixed named arguments order --- src/Controller/Admin/BlogController.php | 12 ++++++------ src/Controller/BlogController.php | 12 ++++++------ src/Controller/UserController.php | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Controller/Admin/BlogController.php b/src/Controller/Admin/BlogController.php index cfa214fa0..6dc0d334b 100644 --- a/src/Controller/Admin/BlogController.php +++ b/src/Controller/Admin/BlogController.php @@ -52,8 +52,8 @@ class BlogController extends AbstractController * could move this annotation to any other controller while maintaining * the route name and therefore, without breaking any existing link. */ - #[Route('/', methods: ['GET'], name: 'admin_index')] - #[Route('/', methods: ['GET'], name: 'admin_post_index')] + #[Route('/', name: 'admin_index', methods: ['GET'])] + #[Route('/', name: 'admin_post_index', methods: ['GET'])] public function index( #[CurrentUser] User $user, PostRepository $posts, @@ -70,7 +70,7 @@ public function index( * to constraint the HTTP methods each controller responds to (by default * it responds to all methods). */ - #[Route('/new', methods: ['GET', 'POST'], name: 'admin_post_new')] + #[Route('/new', name: 'admin_post_new', methods: ['GET', 'POST'])] public function new( #[CurrentUser] User $user, Request $request, @@ -119,7 +119,7 @@ public function new( /** * Finds and displays a Post entity. */ - #[Route('/{id<\d+>}', methods: ['GET'], name: 'admin_post_show')] + #[Route('/{id<\d+>}', name: 'admin_post_show', methods: ['GET'])] public function show(Post $post): Response { // This security check can also be performed @@ -134,7 +134,7 @@ public function show(Post $post): Response /** * Displays a form to edit an existing Post entity. */ - #[Route('/{id<\d+>}/edit', methods: ['GET', 'POST'], name: 'admin_post_edit')] + #[Route('/{id<\d+>}/edit', name: 'admin_post_edit', methods: ['GET', 'POST'])] #[IsGranted('edit', subject: 'post', message: 'Posts can only be edited by their authors.')] public function edit(Request $request, Post $post, EntityManagerInterface $entityManager): Response { @@ -157,7 +157,7 @@ public function edit(Request $request, Post $post, EntityManagerInterface $entit /** * Deletes a Post entity. */ - #[Route('/{id}/delete', methods: ['POST'], name: 'admin_post_delete')] + #[Route('/{id}/delete', name: 'admin_post_delete', methods: ['POST'])] #[IsGranted('delete', subject: 'post')] public function delete(Request $request, Post $post, EntityManagerInterface $entityManager): Response { diff --git a/src/Controller/BlogController.php b/src/Controller/BlogController.php index cdb4eeb07..0490cd435 100644 --- a/src/Controller/BlogController.php +++ b/src/Controller/BlogController.php @@ -44,9 +44,9 @@ class BlogController extends AbstractController * * See https://symfony.com/doc/current/routing.html#special-parameters */ - #[Route('/', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'], name: 'blog_index')] - #[Route('/rss.xml', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'], name: 'blog_rss')] - #[Route('/page/{page<[1-9]\d{0,8}>}', defaults: ['_format' => 'html'], methods: ['GET'], name: 'blog_index_paginated')] + #[Route('/', name: 'blog_index', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'])] + #[Route('/rss.xml', name: 'blog_rss', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'])] + #[Route('/page/{page<[1-9]\d{0,8}>}', name: 'blog_index_paginated', defaults: ['_format' => 'html'], methods: ['GET'])] #[Cache(smaxage: 10)] public function index(Request $request, int $page, string $_format, PostRepository $posts, TagRepository $tags): Response { @@ -72,7 +72,7 @@ public function index(Request $request, int $page, string $_format, PostReposito * * See https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html */ - #[Route('/posts/{slug}', methods: ['GET'], name: 'blog_post')] + #[Route('/posts/{slug}', name: 'blog_post', methods: ['GET'])] public function postShow(Post $post): Response { // Symfony's 'dump()' function is an improved version of PHP's 'var_dump()' but @@ -98,7 +98,7 @@ public function postShow(Post $post): Response * * See https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#doctrine-converter */ - #[Route('/comment/{postSlug}/new', methods: ['POST'], name: 'comment_new')] + #[Route('/comment/{postSlug}/new', name: 'comment_new', methods: ['POST'])] #[IsGranted('IS_AUTHENTICATED')] public function commentNew( #[CurrentUser] User $user, @@ -152,7 +152,7 @@ public function commentForm(Post $post): Response ]); } - #[Route('/search', methods: ['GET'], name: 'blog_search')] + #[Route('/search', name: 'blog_search', methods: ['GET'])] public function search(Request $request): Response { return $this->render('blog/search.html.twig', ['query' => (string) $request->query->get('q', '')]); diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 0c1e6a1be..7d4dc2298 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -34,7 +34,7 @@ #[Route('/profile'), IsGranted('ROLE_USER')] class UserController extends AbstractController { - #[Route('/edit', methods: ['GET', 'POST'], name: 'user_edit')] + #[Route('/edit', name: 'user_edit', methods: ['GET', 'POST'])] public function edit( #[CurrentUser] User $user, Request $request, @@ -57,7 +57,7 @@ public function edit( ]); } - #[Route('/change-password', methods: ['GET', 'POST'], name: 'user_change_password')] + #[Route('/change-password', name: 'user_change_password', methods: ['GET', 'POST'])] public function changePassword( #[CurrentUser] User $user, Request $request,