Skip to content

Commit 84ae312

Browse files
committed
minor #1403 php8: fixed named arguments order (COil)
This PR was squashed before being merged into the main branch. Discussion ---------- php8: fixed named arguments order This is to fix: <img width="695" alt="Capture d’écran 2023-02-14 à 22 25 44" src="https://user-images.githubusercontent.com/177844/218866627-05b23c90-ae83-472c-995f-54f7b55421ac.png"> Commits ------- 5eefef1 php8: fixed named arguments order
2 parents fd22be2 + 5eefef1 commit 84ae312

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/Controller/Admin/BlogController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class BlogController extends AbstractController
5252
* could move this annotation to any other controller while maintaining
5353
* the route name and therefore, without breaking any existing link.
5454
*/
55-
#[Route('/', methods: ['GET'], name: 'admin_index')]
56-
#[Route('/', methods: ['GET'], name: 'admin_post_index')]
55+
#[Route('/', name: 'admin_index', methods: ['GET'])]
56+
#[Route('/', name: 'admin_post_index', methods: ['GET'])]
5757
public function index(
5858
#[CurrentUser] User $user,
5959
PostRepository $posts,
@@ -70,7 +70,7 @@ public function index(
7070
* to constraint the HTTP methods each controller responds to (by default
7171
* it responds to all methods).
7272
*/
73-
#[Route('/new', methods: ['GET', 'POST'], name: 'admin_post_new')]
73+
#[Route('/new', name: 'admin_post_new', methods: ['GET', 'POST'])]
7474
public function new(
7575
#[CurrentUser] User $user,
7676
Request $request,
@@ -119,7 +119,7 @@ public function new(
119119
/**
120120
* Finds and displays a Post entity.
121121
*/
122-
#[Route('/{id<\d+>}', methods: ['GET'], name: 'admin_post_show')]
122+
#[Route('/{id<\d+>}', name: 'admin_post_show', methods: ['GET'])]
123123
public function show(Post $post): Response
124124
{
125125
// This security check can also be performed
@@ -134,7 +134,7 @@ public function show(Post $post): Response
134134
/**
135135
* Displays a form to edit an existing Post entity.
136136
*/
137-
#[Route('/{id<\d+>}/edit', methods: ['GET', 'POST'], name: 'admin_post_edit')]
137+
#[Route('/{id<\d+>}/edit', name: 'admin_post_edit', methods: ['GET', 'POST'])]
138138
#[IsGranted('edit', subject: 'post', message: 'Posts can only be edited by their authors.')]
139139
public function edit(Request $request, Post $post, EntityManagerInterface $entityManager): Response
140140
{
@@ -157,7 +157,7 @@ public function edit(Request $request, Post $post, EntityManagerInterface $entit
157157
/**
158158
* Deletes a Post entity.
159159
*/
160-
#[Route('/{id}/delete', methods: ['POST'], name: 'admin_post_delete')]
160+
#[Route('/{id}/delete', name: 'admin_post_delete', methods: ['POST'])]
161161
#[IsGranted('delete', subject: 'post')]
162162
public function delete(Request $request, Post $post, EntityManagerInterface $entityManager): Response
163163
{

src/Controller/BlogController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class BlogController extends AbstractController
4444
*
4545
* See https://symfony.com/doc/current/routing.html#special-parameters
4646
*/
47-
#[Route('/', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'], name: 'blog_index')]
48-
#[Route('/rss.xml', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'], name: 'blog_rss')]
49-
#[Route('/page/{page<[1-9]\d{0,8}>}', defaults: ['_format' => 'html'], methods: ['GET'], name: 'blog_index_paginated')]
47+
#[Route('/', name: 'blog_index', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'])]
48+
#[Route('/rss.xml', name: 'blog_rss', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'])]
49+
#[Route('/page/{page<[1-9]\d{0,8}>}', name: 'blog_index_paginated', defaults: ['_format' => 'html'], methods: ['GET'])]
5050
#[Cache(smaxage: 10)]
5151
public function index(Request $request, int $page, string $_format, PostRepository $posts, TagRepository $tags): Response
5252
{
@@ -72,7 +72,7 @@ public function index(Request $request, int $page, string $_format, PostReposito
7272
*
7373
* See https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
7474
*/
75-
#[Route('/posts/{slug}', methods: ['GET'], name: 'blog_post')]
75+
#[Route('/posts/{slug}', name: 'blog_post', methods: ['GET'])]
7676
public function postShow(Post $post): Response
7777
{
7878
// Symfony's 'dump()' function is an improved version of PHP's 'var_dump()' but
@@ -98,7 +98,7 @@ public function postShow(Post $post): Response
9898
*
9999
* See https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#doctrine-converter
100100
*/
101-
#[Route('/comment/{postSlug}/new', methods: ['POST'], name: 'comment_new')]
101+
#[Route('/comment/{postSlug}/new', name: 'comment_new', methods: ['POST'])]
102102
#[IsGranted('IS_AUTHENTICATED')]
103103
public function commentNew(
104104
#[CurrentUser] User $user,
@@ -152,7 +152,7 @@ public function commentForm(Post $post): Response
152152
]);
153153
}
154154

155-
#[Route('/search', methods: ['GET'], name: 'blog_search')]
155+
#[Route('/search', name: 'blog_search', methods: ['GET'])]
156156
public function search(Request $request): Response
157157
{
158158
return $this->render('blog/search.html.twig', ['query' => (string) $request->query->get('q', '')]);

src/Controller/UserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#[Route('/profile'), IsGranted('ROLE_USER')]
3535
class UserController extends AbstractController
3636
{
37-
#[Route('/edit', methods: ['GET', 'POST'], name: 'user_edit')]
37+
#[Route('/edit', name: 'user_edit', methods: ['GET', 'POST'])]
3838
public function edit(
3939
#[CurrentUser] User $user,
4040
Request $request,
@@ -57,7 +57,7 @@ public function edit(
5757
]);
5858
}
5959

60-
#[Route('/change-password', methods: ['GET', 'POST'], name: 'user_change_password')]
60+
#[Route('/change-password', name: 'user_change_password', methods: ['GET', 'POST'])]
6161
public function changePassword(
6262
#[CurrentUser] User $user,
6363
Request $request,

0 commit comments

Comments
 (0)