Skip to content

Commit ef5ead0

Browse files
[HttpFoundation] fix return type declarations
1 parent 1f72501 commit ef5ead0

20 files changed

+31
-29
lines changed

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ public function setContent($content)
327327
if (null !== $content) {
328328
throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.');
329329
}
330+
331+
return $this;
330332
}
331333

332334
/**
333335
* {@inheritdoc}
334-
*
335-
* @return false
336336
*/
337337
public function getContent()
338338
{

src/Symfony/Component/HttpFoundation/FileBag.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ protected function convertFileInformation($file)
7575
return $file;
7676
}
7777

78-
$file = $this->fixPhpFilesArray($file);
7978
if (\is_array($file)) {
79+
$file = $this->fixPhpFilesArray($file);
8080
$keys = array_keys($file);
8181
sort($keys);
8282

@@ -109,14 +109,12 @@ protected function convertFileInformation($file)
109109
* It's safe to pass an already converted array, in which case this method
110110
* just returns the original array unmodified.
111111
*
112+
* @param array $data
113+
*
112114
* @return array
113115
*/
114116
protected function fixPhpFilesArray($data)
115117
{
116-
if (!\is_array($data)) {
117-
return $data;
118-
}
119-
120118
$keys = array_keys($data);
121119
sort($keys);
122120

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function get($key, $default = null, $first = true)
121121
}
122122

123123
if ($first) {
124-
return \count($headers[$key]) ? $headers[$key][0] : $default;
124+
return \count($headers[$key]) ? (string) $headers[$key][0] : $default;
125125
}
126126

127127
return $headers[$key];

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ public function __toString()
528528
try {
529529
$content = $this->getContent();
530530
} catch (\LogicException $e) {
531+
if (\PHP_VERSION_ID >= 70400) {
532+
throw $e;
533+
}
534+
531535
return trigger_error($e, E_USER_ERROR);
532536
}
533537

@@ -912,7 +916,7 @@ public function getClientIps()
912916
* ("Client-Ip" for instance), configure it via the $trustedHeaderSet
913917
* argument of the Request::setTrustedProxies() method instead.
914918
*
915-
* @return string The client IP address
919+
* @return string|null The client IP address
916920
*
917921
* @see getClientIps()
918922
* @see https://wikipedia.org/wiki/X-Forwarded-For

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public function setContent($content)
407407
/**
408408
* Gets the current response content.
409409
*
410-
* @return string Content
410+
* @return string|false
411411
*/
412412
public function getContent()
413413
{

src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function remove($name)
9797
* @param string $name Key name
9898
* @param bool $writeContext Write context, default false
9999
*
100-
* @return array
100+
* @return array|null
101101
*/
102102
protected function &resolveAttributePath($name, $writeContext = false)
103103
{

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ class MemcachedSessionHandler extends AbstractSessionHandler
4040
* * prefix: The prefix to use for the memcached keys in order to avoid collision
4141
* * expiretime: The time to live in seconds.
4242
*
43-
* @param \Memcached $memcached A \Memcached instance
44-
* @param array $options An associative array of Memcached options
45-
*
4643
* @throws \InvalidArgumentException When unsupported options are passed
4744
*/
4845
public function __construct(\Memcached $memcached, array $options = [])
@@ -58,7 +55,7 @@ public function __construct(\Memcached $memcached, array $options = [])
5855
}
5956

6057
/**
61-
* {@inheritdoc}
58+
* @return bool
6259
*/
6360
public function close()
6461
{
@@ -74,7 +71,7 @@ protected function doRead($sessionId)
7471
}
7572

7673
/**
77-
* {@inheritdoc}
74+
* @return bool
7875
*/
7976
public function updateTimestamp($sessionId, $data)
8077
{
@@ -102,7 +99,7 @@ protected function doDestroy($sessionId)
10299
}
103100

104101
/**
105-
* {@inheritdoc}
102+
* @return bool
106103
*/
107104
public function gc($maxlifetime)
108105
{

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function doDestroy($sessionId)
6767
}
6868

6969
/**
70-
* {@inheritdoc}
70+
* @return bool
7171
*/
7272
public function gc($maxlifetime)
7373
{

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public function read($sessionId)
286286
}
287287

288288
/**
289-
* {@inheritdoc}
289+
* @return bool
290290
*/
291291
public function gc($maxlifetime)
292292
{

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function close()
9494
}
9595

9696
/**
97-
* {@inheritdoc}
97+
* @return bool
9898
*/
9999
public function gc($maxlifetime)
100100
{

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