Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use Superglobals in setting 'REQUEST_METHOD' in `FeatureT… #9294

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -15295,12 +15295,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/HomeTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/HomeTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down Expand Up @@ -15633,13 +15627,13 @@
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object, array<string, array<int, string>> given\\.$#',
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object, array\\<string, array\\<int, string\\>\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$row of method CodeIgniter\\\\Model\\:\\:update\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object\\|null, array<string, array<int, string>> given\\.$#',
'message' => '#^Parameter \\#2 \\$row of method CodeIgniter\\\\Model\\:\\:update\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object\\|null, array\\<string, array\\<int, string\\>\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/DataConverterModelTest.php',
];
Expand Down Expand Up @@ -16029,7 +16023,7 @@
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array<int\\|string, bool\\|float\\|int\\|object\\|string\\|null>\\|object, array<int, array>\\|null given\\.$#',
'message' => '#^Parameter \\#1 \\$row of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\) expects array\\<int\\|string, bool\\|float\\|int\\|object\\|string\\|null\\>\\|object, array\\<int, array\\>\\|null given\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php',
];
Expand Down Expand Up @@ -17089,12 +17083,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down Expand Up @@ -17203,12 +17191,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
];
$ignoreErrors[] = [
// identifier: codeigniter.superglobalAccessAssign
'message' => '#^Assigning string directly on offset \'REQUEST_METHOD\' of \\$_SERVER is discouraged\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Test/FeatureTestTraitTest.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down
4 changes: 2 additions & 2 deletions system/Test/FeatureTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ public function call(string $method, string $path, ?array $params = null)
$method = strtoupper($method);

// Simulate having a blank session
$_SESSION = [];
$_SERVER['REQUEST_METHOD'] = $method;
$_SESSION = [];
service('superglobals')->setServer('REQUEST_METHOD', $method);

$request = $this->setupRequest($method, $path);
$request = $this->setupHeaders($request);
Expand Down
Loading