Skip to content

Commit e246bc4

Browse files
Explain status codes in comments
1 parent 82a84cf commit e246bc4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Controller/AbstractController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ protected function forward(string $controller, array $path = [], array $query =
124124

125125
/**
126126
* Returns a RedirectResponse to the given URL.
127+
*
128+
* @param int $status The HTTP status code (302 "Found" by default)
127129
*/
128130
protected function redirect(string $url, int $status = 302): RedirectResponse
129131
{
@@ -132,6 +134,8 @@ protected function redirect(string $url, int $status = 302): RedirectResponse
132134

133135
/**
134136
* Returns a RedirectResponse to the given route with the given parameters.
137+
*
138+
* @param int $status The HTTP status code (302 "Found" by default)
135139
*/
136140
protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse
137141
{
@@ -140,6 +144,8 @@ protected function redirectToRoute(string $route, array $parameters = [], int $s
140144

141145
/**
142146
* Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
147+
*
148+
* @param int $status The HTTP status code (200 "OK" by default)
143149
*/
144150
protected function json(mixed $data, int $status = 200, array $headers = [], array $context = []): JsonResponse
145151
{

Controller/TemplateController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(Environment $twig = null)
3838
* @param int|null $sharedAge Max age for shared (proxy) caching
3939
* @param bool|null $private Whether or not caching should apply for client caches only
4040
* @param array $context The context (arguments) of the template
41-
* @param int $statusCode The HTTP status code to return with the response. Defaults to 200
41+
* @param int $statusCode The HTTP status code to return with the response (200 "OK" by default)
4242
*/
4343
public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
4444
{
@@ -65,6 +65,9 @@ public function templateAction(string $template, int $maxAge = null, int $shared
6565
return $response;
6666
}
6767

68+
/**
69+
* @param int $statusCode The HTTP status code (200 "OK" by default)
70+
*/
6871
public function __invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
6972
{
7073
return $this->templateAction($template, $maxAge, $sharedAge, $private, $context, $statusCode);

0 commit comments

Comments
 (0)