New PHP 7.1 type hints for AbstractApiController.

This commit is contained in:
Alexey Skobkin 2017-01-13 02:03:27 +03:00
parent d289571c5b
commit df244c90bd

View file

@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\Response;
class AbstractApiController extends Controller class AbstractApiController extends Controller
{ {
protected function createSuccessResponse($data, $code = 200): Response protected function createSuccessResponse($data, int $code = 200): Response
{ {
return $this->json([ return $this->json([
'status' => 'success', 'status' => 'success',
@ -18,12 +18,12 @@ class AbstractApiController extends Controller
/** /**
* *
*/ */
protected function createErrorResponse($message, $code = 400): Response protected function createErrorResponse(string $message, int $code = 400): Response
{ {
return $this->json([ return $this->json([
'status' => 'fail', 'status' => 'fail',
'error' => [ 'error' => [
'code' => (int) $code, 'code' => $code,
'message' => $message 'message' => $message
] ]
], $code); ], $code);