Commit 47d6b51c authored by Guillaume Perréal's avatar Guillaume Perréal

UploadController: return type hints.

parent d40c50ed
......@@ -91,7 +91,7 @@ class UploadController extends Controller
*
* @return JsonResponse
*/
public function createAction(Request $request)
public function createAction(Request $request): JsonResponse
{
$request->setRequestFormat(self::REQUEST_FORMAT);
$data = $request->request->get('file');
......@@ -136,7 +136,7 @@ class UploadController extends Controller
*
* @return JsonResponse|Response
*/
public function putContentAction(Request $request, UploadedFile $file)
public function putContentAction(Request $request, UploadedFile $file): Response
{
$request->setRequestFormat(self::REQUEST_FORMAT);
$this->validateCsrfToken($request);
......@@ -160,7 +160,7 @@ class UploadController extends Controller
*
* @return array
*/
protected function handleRangeHeader(Request $request)
protected function handleRangeHeader(Request $request): array
{
if (!$request->headers->has('Content-Range')) {
return [0, PHP_INT_MAX, true];
......@@ -188,7 +188,7 @@ class UploadController extends Controller
*
* @return Response
*/
protected function completeUpload(UploadedFileInterface $file)
protected function completeUpload(UploadedFileInterface $file): Response
{
try {
$this->fileManager->completed($file);
......@@ -222,7 +222,7 @@ class UploadController extends Controller
*
* @return UploadedFileResponse
*/
public function getContentAction(Request $request, UploadedFile $file)
public function getContentAction(Request $request, UploadedFile $file): UploadedFileResponse
{
$this->validateCsrfToken($request);
......@@ -245,7 +245,7 @@ class UploadController extends Controller
*
* @return JsonResponse
*/
public function deleteAction(Request $request, UploadedFile $file)
public function deleteAction(Request $request, UploadedFile $file): JsonResponse
{
$request->setRequestFormat(self::REQUEST_FORMAT);
......@@ -261,7 +261,7 @@ class UploadController extends Controller
*
* @throws HttpException
*/
protected function validateCsrfToken(Request $request)
protected function validateCsrfToken(Request $request): void
{
$token = $this->csrfTokenManager->getToken($request->query->get('token'));
if (!$this->csrfTokenManager->isTokenValid($token)) {
......@@ -277,7 +277,7 @@ class UploadController extends Controller
*
* @return JsonResponse
*/
protected function createResponse($status = Response::HTTP_OK, $message = 'OK', array $data = [], array $headers = [])
protected function createResponse($status = Response::HTTP_OK, $message = 'OK', array $data = [], array $headers = []): JsonResponse
{
$data['status'] = $status;
$data['message'] = $message;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment