Skip to content

Commit 2cc0e58

Browse files
committed
update tests for files superglobals
1 parent 294e62e commit 2cc0e58

File tree

5 files changed

+116
-114
lines changed

5 files changed

+116
-114
lines changed

system/HTTP/Files/FileCollection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,13 @@ protected function populateFiles()
150150

151151
$this->files = [];
152152

153-
if ($_FILES === []) {
153+
$files = service('superglobals')->getFilesArray();
154+
155+
if ($files === []) {
154156
return;
155157
}
156158

157-
$files = $this->fixFilesArray($_FILES);
159+
$files = $this->fixFilesArray($files);
158160

159161
foreach ($files as $name => $file) {
160162
$this->files[$name] = $this->createFileObject($file);

system/Superglobals.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ final class Superglobals
5656
private array $request;
5757

5858
/**
59-
* @var array<string, array{name: list<string>|string, type: list<string>|string, tmp_name: list<string>|string, error: int|list<int>, size: int|list<int>, full_path?: list<string>|string}>
59+
* @var array<string, array<string, mixed>>
6060
*/
6161
private array $files;
6262

6363
/**
64-
* @param array<string, array|float|int|string>|null $server
65-
* @param array<string, array|string>|null $get
66-
* @param array<string, array|string>|null $post
67-
* @param array<string, array|string>|null $cookie
68-
* @param array<string, array|string>|null $request
69-
* @param array<string, array{name: list<string>|string, type: list<string>|string, tmp_name: list<string>|string, error: int|list<int>, size: int|list<int>, full_path?: list<string>|string}>|null $files
64+
* @param array<string, array|float|int|string>|null $server
65+
* @param array<string, array|string>|null $get
66+
* @param array<string, array|string>|null $post
67+
* @param array<string, array|string>|null $cookie
68+
* @param array<string, array|string>|null $request
69+
* @param array<string, array<string, mixed>>|null $files
7070
*/
7171
public function __construct(
7272
?array $server = null,
@@ -337,7 +337,7 @@ public function setRequestArray(array $array): void
337337
/**
338338
* Get all $_FILES values
339339
*
340-
* @return array<string, array{name: list<string>|string, type: list<string>|string, tmp_name: list<string>|string, error: int|list<int>, size: int|list<int>, full_path?: list<string>|string}>
340+
* @return array<string, array<string, mixed>>
341341
*/
342342
public function getFilesArray(): array
343343
{
@@ -347,7 +347,7 @@ public function getFilesArray(): array
347347
/**
348348
* Set the entire $_FILES array
349349
*
350-
* @param array<string, array{name: list<string>|string, type: list<string>|string, tmp_name: list<string>|string, error: int|list<int>, size: int|list<int>, full_path?: list<string>|string}> $array
350+
* @param array<string, array<string, mixed>> $array
351351
*/
352352
public function setFilesArray(array $array): void
353353
{

0 commit comments

Comments
 (0)