From 8b9b62048c0dfcfa5254fe4cb1a07b6a92e15f96 Mon Sep 17 00:00:00 2001 From: kick-the-bucket Date: Mon, 30 Nov 2020 18:59:21 +0200 Subject: [PATCH] Remove unused @throws tags and handling of never thrown exceptions --- .../Component/HttpFoundation/JsonResponse.php | 2 -- src/Symfony/Component/HttpFoundation/Request.php | 14 +------------- .../DataCollector/RequestDataCollector.php | 7 +------ 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index f6b247bfa1..6728d596b3 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -129,8 +129,6 @@ class JsonResponse extends Response * @param string $json * * @return $this - * - * @throws \InvalidArgumentException */ public function setJson($json) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 14775fdef3..d03c12a61b 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -504,15 +504,7 @@ class Request */ public function __toString() { - try { - $content = $this->getContent(); - } catch (\LogicException $e) { - if (\PHP_VERSION_ID >= 70400) { - throw $e; - } - - return trigger_error($e, \E_USER_ERROR); - } + $content = $this->getContent(); $cookieHeader = ''; $cookies = []; @@ -577,8 +569,6 @@ class Request * * @param array $proxies A list of trusted proxies, the string 'REMOTE_ADDR' will be replaced with $_SERVER['REMOTE_ADDR'] * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies - * - * @throws \InvalidArgumentException When $trustedHeaderSet is invalid */ public static function setTrustedProxies(array $proxies, int $trustedHeaderSet) { @@ -1527,8 +1517,6 @@ class Request * @param bool $asResource If true, a resource will be returned * * @return string|resource The request body content or a resource to read the body stream - * - * @throws \LogicException */ public function getContent($asResource = false) { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index ba68c6b99a..56bc6ec194 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -53,12 +53,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter } } - try { - $content = $request->getContent(); - } catch (\LogicException $e) { - // the user already got the request content as a resource - $content = false; - } + $content = $request->getContent(); $sessionMetadata = []; $sessionAttributes = [];