diff --git a/Resources/doc/examples/RssHandler.php b/Resources/doc/examples/RssHandler.php index 9e93ef6cc..3a5adc2e7 100644 --- a/Resources/doc/examples/RssHandler.php +++ b/Resources/doc/examples/RssHandler.php @@ -58,7 +58,7 @@ public function __construct(LoggerInterface $logger = null) * * @return Response */ - public function createResponse(ViewHandler $handler, View $view, Request $request) + public function createResponse(ViewHandler $handler, View $view, Request $request): \Symfony\Component\HttpFoundation\Response { try { $content = $this->createFeed($view->getData()); diff --git a/Tests/EventListener/ParamFetcherListenerTest.php b/Tests/EventListener/ParamFetcherListenerTest.php index 6aae8e27b..4e4dc5246 100644 --- a/Tests/EventListener/ParamFetcherListenerTest.php +++ b/Tests/EventListener/ParamFetcherListenerTest.php @@ -144,7 +144,7 @@ public function setParamFetcherByTypehintProvider() return $paramFetcher; } - protected function getEvent(Request $request, $actionMethod = 'byNameAction') + protected function getEvent(Request $request, $actionMethod = 'byNameAction'): \Symfony\Component\HttpKernel\Event\ControllerEvent { $this->requestStack->push($request); diff --git a/Tests/EventListener/ViewResponseListenerTest.php b/Tests/EventListener/ViewResponseListenerTest.php index cbc6b98fd..8bca8519f 100644 --- a/Tests/EventListener/ViewResponseListenerTest.php +++ b/Tests/EventListener/ViewResponseListenerTest.php @@ -50,7 +50,7 @@ class ViewResponseListenerTest extends TestCase /** * @return ControllerEvent|\PHPUnit_Framework_MockObject_MockObject */ - protected function getFilterEvent(Request $request) + protected function getFilterEvent(Request $request): \Symfony\Component\HttpKernel\Event\ControllerEvent { $controller = new FooController(); $kernel = $this->createMock(HttpKernelInterface::class); @@ -63,7 +63,7 @@ protected function getFilterEvent(Request $request) * * @return ViewEvent|\PHPUnit_Framework_MockObject_MockObject */ - protected function getResponseEvent(Request $request, $result) + protected function getResponseEvent(Request $request, $result): \Symfony\Component\HttpKernel\Event\ViewEvent { $kernel = $this->createMock(HttpKernelInterface::class); diff --git a/Tests/Functional/Bundle/TestBundle/Controller/AllowedMethodsController.php b/Tests/Functional/Bundle/TestBundle/Controller/AllowedMethodsController.php index 7e3504fcf..9f027430f 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/AllowedMethodsController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/AllowedMethodsController.php @@ -15,7 +15,7 @@ class AllowedMethodsController { - public function indexAction() + public function indexAction(): \Symfony\Component\HttpFoundation\Response { return new Response(); } diff --git a/Tests/Functional/Bundle/TestBundle/Controller/Api/CommentController.php b/Tests/Functional/Bundle/TestBundle/Controller/Api/CommentController.php index 351862507..5a4aa70ae 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/Api/CommentController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/Api/CommentController.php @@ -15,17 +15,17 @@ class CommentController { - public function loginAction() + public function loginAction(): \Symfony\Component\HttpFoundation\JsonResponse { return new JsonResponse('login'); } - public function getCommentAction($id) + public function getCommentAction($id): \Symfony\Component\HttpFoundation\JsonResponse { return new JsonResponse(['id' => (int) $id]); } - public function getComments() + public function getComments(): \Symfony\Component\HttpFoundation\JsonResponse { return new JsonResponse([]); } diff --git a/Tests/Functional/Bundle/TestBundle/Controller/CommentController.php b/Tests/Functional/Bundle/TestBundle/Controller/CommentController.php index d335ac3df..778341619 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/CommentController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/CommentController.php @@ -15,12 +15,12 @@ class CommentController { - public function getCommentAction($id) + public function getCommentAction($id): \Symfony\Component\HttpFoundation\Response { return new Response("$id"); } - public function getComments() + public function getComments(): \Symfony\Component\HttpFoundation\Response { return new Response('comments ..'); } diff --git a/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php b/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php index 5464e8431..a7098f48a 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php @@ -31,7 +31,7 @@ class ParamFetcherController extends AbstractFOSRestController * @QueryParam(name="foz", requirements="[a-z]+") * @QueryParam(name="baz", requirements="[a-z]+", incompatibles={"foz"}) */ - public function paramsAction(ParamFetcherInterface $fetcher) + public function paramsAction(ParamFetcherInterface $fetcher): \Symfony\Component\HttpFoundation\JsonResponse { return new JsonResponse($fetcher->all()); } @@ -40,7 +40,7 @@ public function paramsAction(ParamFetcherInterface $fetcher) * @QueryParam(name="foo", default="invalid") * @RequestParam(name="bar", default="%foo%") */ - public function testAction(Request $request, ParamFetcherInterface $fetcher) + public function testAction(Request $request, ParamFetcherInterface $fetcher): \Symfony\Component\HttpFoundation\JsonResponse { $paramsBefore = $fetcher->all(); @@ -61,7 +61,7 @@ public function testAction(Request $request, ParamFetcherInterface $fetcher) /** * @FileParam(name="single_file", strict=false, default="noFile") */ - public function singleFileAction(ParamFetcherInterface $fetcher) + public function singleFileAction(ParamFetcherInterface $fetcher): \Symfony\Component\HttpFoundation\JsonResponse { /** @var UploadedFile $file */ $file = $fetcher->get('single_file'); @@ -74,7 +74,7 @@ public function singleFileAction(ParamFetcherInterface $fetcher) /** * @FileParam(name="array_files", map=true) */ - public function fileCollectionAction(ParamFetcherInterface $fetcher) + public function fileCollectionAction(ParamFetcherInterface $fetcher): \Symfony\Component\HttpFoundation\JsonResponse { $files = $fetcher->get('array_files'); @@ -89,7 +89,7 @@ public function fileCollectionAction(ParamFetcherInterface $fetcher) /** * @FileParam(name="array_images", image=true, strict=false, map=true, default="NotAnImage") */ - public function imageCollectionAction(ParamFetcherInterface $fetcher) + public function imageCollectionAction(ParamFetcherInterface $fetcher): \Symfony\Component\HttpFoundation\JsonResponse { $files = $fetcher->get('array_images'); diff --git a/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php b/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php index 602413ec9..8db9c167f 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php @@ -20,7 +20,7 @@ class RequestBodyParamConverterController extends AbstractController /** * @ParamConverter("post", converter="fos_rest.request_body") */ - public function putPostAction(Post $post, \Datetime $date) + public function putPostAction(Post $post, \Datetime $date): \Symfony\Component\HttpFoundation\Response { return new Response($post->getName()); } diff --git a/Tests/Functional/Bundle/TestBundle/Security/ApiToken53Authenticator.php b/Tests/Functional/Bundle/TestBundle/Security/ApiToken53Authenticator.php index 54331828c..3bab0bc08 100644 --- a/Tests/Functional/Bundle/TestBundle/Security/ApiToken53Authenticator.php +++ b/Tests/Functional/Bundle/TestBundle/Security/ApiToken53Authenticator.php @@ -36,7 +36,7 @@ public function authenticate(Request $request): PassportInterface throw new BadCredentialsException(); } - $userBadge = new UserBadge($this->tokenValue, function () { + $userBadge = new UserBadge($this->tokenValue, function (): \FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Entity\User { $user = new User(); $user->username = 'foo'; $user->roles[] = 'ROLE_API'; diff --git a/Tests/Functional/Bundle/TestBundle/Security/ApiTokenAuthenticator.php b/Tests/Functional/Bundle/TestBundle/Security/ApiTokenAuthenticator.php index c0262e277..aedbed01e 100644 --- a/Tests/Functional/Bundle/TestBundle/Security/ApiTokenAuthenticator.php +++ b/Tests/Functional/Bundle/TestBundle/Security/ApiTokenAuthenticator.php @@ -36,7 +36,7 @@ public function authenticate(Request $request): Passport throw new BadCredentialsException(); } - $userBadge = new UserBadge($this->tokenValue, function () { + $userBadge = new UserBadge($this->tokenValue, function (): \FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Entity\User { $user = new User(); $user->username = 'foo'; $user->roles[] = 'ROLE_API'; diff --git a/Tests/Request/RequestBodyParamConverterTest.php b/Tests/Request/RequestBodyParamConverterTest.php index 396f268fe..93629efc8 100644 --- a/Tests/Request/RequestBodyParamConverterTest.php +++ b/Tests/Request/RequestBodyParamConverterTest.php @@ -271,7 +271,7 @@ protected function launchExecution($converter, $request = null, $configuration = return $converter->apply($request, $configuration); } - protected function createConfiguration($class, $name = null, array $options = []) + protected function createConfiguration($class, $name = null, array $options = []): \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter { return new ParamConverter([ 'name' => (string) $name, @@ -281,7 +281,7 @@ protected function createConfiguration($class, $name = null, array $options = [] ]); } - protected function createRequest($body = null, $contentType = null) + protected function createRequest($body = null, $contentType = null): \Symfony\Component\HttpFoundation\Request { $request = new Request( [], diff --git a/Tests/View/ViewHandlerTest.php b/Tests/View/ViewHandlerTest.php index 26ece5058..a210953f0 100644 --- a/Tests/View/ViewHandlerTest.php +++ b/Tests/View/ViewHandlerTest.php @@ -329,7 +329,7 @@ public static function createSerializeNullDataValuesDataProvider() public function testCreateResponse($expected, $formats) { $viewHandler = $this->createViewHandler($formats); - $viewHandler->registerHandler('html', function ($handler, View $view) { + $viewHandler->registerHandler('html', function ($handler, View $view): \Symfony\Component\HttpFoundation\Response { return new Response('', $view->getStatusCode()); }); @@ -349,7 +349,7 @@ public static function createResponseDataProvider() public function testHandleCustom() { $viewHandler = $this->createViewHandler([]); - $viewHandler->registerHandler('html', (function () { + $viewHandler->registerHandler('html', (function (): \Symfony\Component\HttpFoundation\Response { return new Response('foo'); }));