Skip to content

Commit 5ba09f2

Browse files
committed
reorder superglobals params
1 parent 2cc0e58 commit 5ba09f2

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

system/Config/Services.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,14 +748,15 @@ public static function superglobals(
748748
?array $get = null,
749749
?array $post = null,
750750
?array $cookie = null,
751+
?array $files = null,
751752
?array $request = null,
752753
bool $getShared = true,
753754
) {
754755
if ($getShared) {
755-
return static::getSharedInstance('superglobals', $server, $get, $post, $cookie, $request);
756+
return static::getSharedInstance('superglobals', $server, $get, $post, $cookie, $files, $request);
756757
}
757758

758-
return new Superglobals($server, $get, $post, $cookie, $request);
759+
return new Superglobals($server, $get, $post, $cookie, $files, $request);
759760
}
760761

761762
/**

system/Superglobals.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ final class Superglobals
6565
* @param array<string, array|string>|null $get
6666
* @param array<string, array|string>|null $post
6767
* @param array<string, array|string>|null $cookie
68-
* @param array<string, array|string>|null $request
6968
* @param array<string, array<string, mixed>>|null $files
69+
* @param array<string, array|string>|null $request
7070
*/
7171
public function __construct(
7272
?array $server = null,
7373
?array $get = null,
7474
?array $post = null,
7575
?array $cookie = null,
76-
?array $request = null,
7776
?array $files = null,
77+
?array $request = null,
7878
) {
7979
$this->server = $server ?? $_SERVER;
8080
$this->get = $get ?? $_GET;
8181
$this->post = $post ?? $_POST;
8282
$this->cookie = $cookie ?? $_COOKIE;
83-
$this->request = $request ?? $_REQUEST;
8483
$this->files = $files ?? $_FILES;
84+
$this->request = $request ?? $_REQUEST;
8585
}
8686

8787
/**

tests/system/SuperglobalsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function setUp(): void
2929
parent::setUp();
3030

3131
// Clear superglobals before each test
32-
$_SERVER = $_GET = $_POST = $_COOKIE = $_REQUEST = $_FILES = [];
32+
$_SERVER = $_GET = $_POST = $_COOKIE = $_FILES = $_REQUEST = [];
3333

3434
$this->superglobals = new Superglobals();
3535
}
@@ -442,7 +442,7 @@ public function testConstructorWithCustomArrays(): void
442442
],
443443
];
444444

445-
$superglobals = new Superglobals($server, $get, $post, $cookie, $request, $files);
445+
$superglobals = new Superglobals($server, $get, $post, $cookie, $files, $request);
446446

447447
$this->assertSame('server_value', $superglobals->server('SERVER_KEY'));
448448
$this->assertSame('get_value', $superglobals->get('get_key'));

0 commit comments

Comments
 (0)