Skip to content

Commit e28b3dc

Browse files
minor #39246 [HttpFoundation] Throws cleanup (kick-the-bucket)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpFoundation] Throws cleanup | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | The actual throw statements have been removed years ago, but the annotations stayed. Such annotations fool static analysis tools to trigger false positives for unhandled exceptions. Commits ------- 8b9b62048c Remove unused @throws tags and handling of never thrown exceptions
2 parents f92cec8 + 7d0b2a7 commit e28b3dc

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

JsonResponse.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ public function setCallback($callback = null)
133133
* @param string $json
134134
*
135135
* @return $this
136-
*
137-
* @throws \InvalidArgumentException
138136
*/
139137
public function setJson($json)
140138
{

Request.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,7 @@ public function __clone()
504504
*/
505505
public function __toString()
506506
{
507-
try {
508-
$content = $this->getContent();
509-
} catch (\LogicException $e) {
510-
if (\PHP_VERSION_ID >= 70400) {
511-
throw $e;
512-
}
513-
514-
return trigger_error($e, \E_USER_ERROR);
515-
}
507+
$content = $this->getContent();
516508

517509
$cookieHeader = '';
518510
$cookies = [];
@@ -577,8 +569,6 @@ public function overrideGlobals()
577569
*
578570
* @param array $proxies A list of trusted proxies, the string 'REMOTE_ADDR' will be replaced with $_SERVER['REMOTE_ADDR']
579571
* @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies
580-
*
581-
* @throws \InvalidArgumentException When $trustedHeaderSet is invalid
582572
*/
583573
public static function setTrustedProxies(array $proxies, int $trustedHeaderSet)
584574
{
@@ -1527,8 +1517,6 @@ public function getProtocolVersion()
15271517
* @param bool $asResource If true, a resource will be returned
15281518
*
15291519
* @return string|resource The request body content or a resource to read the body stream
1530-
*
1531-
* @throws \LogicException
15321520
*/
15331521
public function getContent($asResource = false)
15341522
{

0 commit comments

Comments
 (0)