Skip to content

Commit 973a883

Browse files
Merge branch '4.4' into 5.2
* 4.4: Backport type fixes uzb translation [DependencyInjection] Fix doc blocks [DependencyInjection] Turn $defaultDeprecationTemplate into a constant [Form] better form doc types to support static analysis
2 parents 62ede3f + 605a05b commit 973a883

File tree

5 files changed

+21
-23
lines changed

5 files changed

+21
-23
lines changed

File/UploadedFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static function getMaxFilesize()
231231
*
232232
* @return int|float Returns float if size > PHP_INT_MAX
233233
*/
234-
private static function parseFilesize($size)
234+
private static function parseFilesize(string $size)
235235
{
236236
if ('' === $size) {
237237
return 0;

FileBag.php

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

78-
if (\is_array($file)) {
79-
$file = $this->fixPhpFilesArray($file);
80-
$keys = array_keys($file);
81-
sort($keys);
82-
83-
if (self::FILE_KEYS == $keys) {
84-
if (\UPLOAD_ERR_NO_FILE == $file['error']) {
85-
$file = null;
86-
} else {
87-
$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], false);
88-
}
78+
$file = $this->fixPhpFilesArray($file);
79+
$keys = array_keys($file);
80+
sort($keys);
81+
82+
if (self::FILE_KEYS == $keys) {
83+
if (\UPLOAD_ERR_NO_FILE == $file['error']) {
84+
$file = null;
8985
} else {
90-
$file = array_map([$this, 'convertFileInformation'], $file);
91-
if (array_keys($keys) === $keys) {
92-
$file = array_filter($file);
93-
}
86+
$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], false);
87+
}
88+
} else {
89+
$file = array_map(function ($v) { return $v instanceof UploadedFile || \is_array($v) ? $this->convertFileInformation($v) : $v; }, $file);
90+
if (array_keys($keys) === $keys) {
91+
$file = array_filter($file);
9492
}
9593
}
9694

HeaderBag.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public function get(string $key, string $default = null)
123123
/**
124124
* Sets a header by name.
125125
*
126-
* @param string|string[] $values The value or an array of values
127-
* @param bool $replace Whether to replace the actual value or not (true by default)
126+
* @param string|string[]|null $values The value or an array of values
127+
* @param bool $replace Whether to replace the actual value or not (true by default)
128128
*/
129129
public function set(string $key, $values, bool $replace = true)
130130
{
@@ -208,7 +208,7 @@ public function getDate(string $key, \DateTime $default = null)
208208
/**
209209
* Adds a custom Cache-Control directive.
210210
*
211-
* @param mixed $value The Cache-Control directive value
211+
* @param bool|string $value The Cache-Control directive value
212212
*/
213213
public function addCacheControlDirective(string $key, $value = true)
214214
{
@@ -230,11 +230,11 @@ public function hasCacheControlDirective(string $key)
230230
/**
231231
* Returns a Cache-Control directive value by name.
232232
*
233-
* @return mixed The directive value if defined, null otherwise
233+
* @return bool|string|null The directive value if defined, null otherwise
234234
*/
235235
public function getCacheControlDirective(string $key)
236236
{
237-
return \array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
237+
return $this->cacheControl[$key] ?? null;
238238
}
239239

240240
/**

Tests/JsonResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function testConstructorWithNullAsDataThrowsAnUnexpectedValueException()
276276
public function testConstructorWithObjectWithToStringMethod()
277277
{
278278
$class = new class() {
279-
public function __toString()
279+
public function __toString(): string
280280
{
281281
return '{}';
282282
}

Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testUpdateTimestamp()
122122
$lowTtl = 10;
123123

124124
$this->redisClient->setex(self::PREFIX.'id', $lowTtl, 'foo');
125-
$this->storage->updateTimestamp('id', []);
125+
$this->storage->updateTimestamp('id', 'data');
126126

127127
$this->assertGreaterThan($lowTtl, $this->redisClient->ttl(self::PREFIX.'id'));
128128
}

0 commit comments

Comments
 (0)