Skip to content

Commit e40dd66

Browse files
committed
[PsrHttpMessageBridge] Patch return types and fix CS
1 parent 266c09f commit e40dd66

File tree

8 files changed

+20
-58
lines changed

8 files changed

+20
-58
lines changed

src/Symfony/Bridge/PsrHttpMessage/ArgumentValueResolver/PsrServerRequestResolver.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function __construct(HttpMessageFactoryInterface $httpMessageFactory)
4141
$this->httpMessageFactory = $httpMessageFactory;
4242
}
4343

44-
/**
45-
* {@inheritdoc}
46-
*/
4744
public function supports(Request $request, ArgumentMetadata $argument): bool
4845
{
4946
if ($this instanceof BaseValueResolverInterface) {
@@ -53,9 +50,6 @@ public function supports(Request $request, ArgumentMetadata $argument): bool
5350
return self::SUPPORTED_TYPES[$argument->getType()] ?? false;
5451
}
5552

56-
/**
57-
* {@inheritdoc}
58-
*/
5953
public function resolve(Request $request, ArgumentMetadata $argument): \Traversable
6054
{
6155
if (!isset(self::SUPPORTED_TYPES[$argument->getType()])) {

src/Symfony/Bridge/PsrHttpMessage/EventListener/PsrResponseListener.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Bridge\PsrHttpMessage\EventListener;
413

514
use Psr\Http\Message\ResponseInterface;
@@ -38,9 +47,6 @@ public function onKernelView(ViewEvent $event): void
3847
$event->setResponse($this->httpFoundationFactory->createResponse($controllerResult));
3948
}
4049

41-
/**
42-
* {@inheritdoc}
43-
*/
4450
public static function getSubscribedEvents(): array
4551
{
4652
return [

src/Symfony/Bridge/PsrHttpMessage/Factory/HttpFoundationFactory.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
use Symfony\Component\HttpFoundation\StreamedResponse;
2424

2525
/**
26-
* {@inheritdoc}
27-
*
2826
* @author Kévin Dunglas <dunglas@gmail.com>
2927
*/
3028
class HttpFoundationFactory implements HttpFoundationFactoryInterface
@@ -39,12 +37,7 @@ public function __construct(int $responseBufferMaxLength = 16372)
3937
$this->responseBufferMaxLength = $responseBufferMaxLength;
4038
}
4139

42-
/**
43-
* {@inheritdoc}
44-
*
45-
* @return Request
46-
*/
47-
public function createRequest(ServerRequestInterface $psrRequest, bool $streamed = false)
40+
public function createRequest(ServerRequestInterface $psrRequest, bool $streamed = false): Request
4841
{
4942
$server = [];
5043
$uri = $psrRequest->getUri();
@@ -113,20 +106,13 @@ private function createUploadedFile(UploadedFileInterface $psrUploadedFile): Upl
113106

114107
/**
115108
* Gets a temporary file path.
116-
*
117-
* @return string
118109
*/
119-
protected function getTemporaryPath()
110+
protected function getTemporaryPath(): string
120111
{
121112
return tempnam(sys_get_temp_dir(), uniqid('symfony', true));
122113
}
123114

124-
/**
125-
* {@inheritdoc}
126-
*
127-
* @return Response
128-
*/
129-
public function createResponse(ResponseInterface $psrResponse, bool $streamed = false)
115+
public function createResponse(ResponseInterface $psrResponse, bool $streamed = false): Response
130116
{
131117
$cookies = $psrResponse->getHeader('Set-Cookie');
132118
$psrResponse = $psrResponse->withoutHeader('Set-Cookie');

src/Symfony/Bridge/PsrHttpMessage/Factory/PsrHttpFactory.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ public function __construct(ServerRequestFactoryInterface $serverRequestFactory,
4646
$this->responseFactory = $responseFactory;
4747
}
4848

49-
/**
50-
* {@inheritdoc}
51-
*
52-
* @return ServerRequestInterface
53-
*/
54-
public function createRequest(Request $symfonyRequest)
49+
public function createRequest(Request $symfonyRequest): ServerRequestInterface
5550
{
5651
$uri = $symfonyRequest->server->get('QUERY_STRING', '');
5752
$uri = $symfonyRequest->getSchemeAndHttpHost().$symfonyRequest->getBaseUrl().$symfonyRequest->getPathInfo().('' !== $uri ? '?'.$uri : '');
@@ -141,12 +136,7 @@ private function createUploadedFile(UploadedFile $symfonyUploadedFile): Uploaded
141136
);
142137
}
143138

144-
/**
145-
* {@inheritdoc}
146-
*
147-
* @return ResponseInterface
148-
*/
149-
public function createResponse(Response $symfonyResponse)
139+
public function createResponse(Response $symfonyResponse): ResponseInterface
150140
{
151141
$response = $this->responseFactory->createResponse($symfonyResponse->getStatusCode(), Response::$statusTexts[$symfonyResponse->getStatusCode()] ?? '');
152142

src/Symfony/Bridge/PsrHttpMessage/Factory/UploadedFile.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public function __construct(UploadedFileInterface $psrUploadedFile, callable $ge
4949
$this->psrUploadedFile = $psrUploadedFile;
5050
}
5151

52-
/**
53-
* {@inheritdoc}
54-
*/
5552
public function move(string $directory, string $name = null): File
5653
{
5754
if (!$this->isValid() || $this->test) {
@@ -63,7 +60,7 @@ public function move(string $directory, string $name = null): File
6360
try {
6461
$this->psrUploadedFile->moveTo((string) $target);
6562
} catch (\RuntimeException $e) {
66-
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, $e->getMessage()), 0, $e);
63+
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, $e->getMessage()), 0, $e);
6764
}
6865

6966
@chmod($target, 0666 & ~umask());

src/Symfony/Bridge/PsrHttpMessage/HttpFoundationFactoryInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ interface HttpFoundationFactoryInterface
2525
{
2626
/**
2727
* Creates a Symfony Request instance from a PSR-7 one.
28-
*
29-
* @return Request
3028
*/
31-
public function createRequest(ServerRequestInterface $psrRequest, bool $streamed = false);
29+
public function createRequest(ServerRequestInterface $psrRequest, bool $streamed = false): Request;
3230

3331
/**
3432
* Creates a Symfony Response instance from a PSR-7 one.
35-
*
36-
* @return Response
3733
*/
38-
public function createResponse(ResponseInterface $psrResponse, bool $streamed = false);
34+
public function createResponse(ResponseInterface $psrResponse, bool $streamed = false): Response;
3935
}

src/Symfony/Bridge/PsrHttpMessage/HttpMessageFactoryInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ interface HttpMessageFactoryInterface
2525
{
2626
/**
2727
* Creates a PSR-7 Request instance from a Symfony one.
28-
*
29-
* @return ServerRequestInterface
3028
*/
31-
public function createRequest(Request $symfonyRequest);
29+
public function createRequest(Request $symfonyRequest): ServerRequestInterface;
3230

3331
/**
3432
* Creates a PSR-7 Response instance from a Symfony one.
35-
*
36-
* @return ResponseInterface
3733
*/
38-
public function createResponse(Response $symfonyResponse);
34+
public function createResponse(Response $symfonyResponse): ResponseInterface;
3935
}

src/Symfony/Bridge/PsrHttpMessage/Tests/EventListener/PsrResponseListenerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ public function testDoesNotConvertControllerResult()
4646
self::assertFalse($event->hasResponse());
4747
}
4848

49-
/**
50-
* @param mixed $controllerResult
51-
*/
52-
private function createEventMock($controllerResult): ViewEvent
49+
private function createEventMock(mixed $controllerResult): ViewEvent
5350
{
5451
return new ViewEvent($this->createMock(HttpKernelInterface::class), new Request(), HttpKernelInterface::MAIN_REQUEST, $controllerResult);
5552
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy