Skip to content

Commit b7fee09

Browse files
Merge pull request #20494 from kamil-tekiela/New-in-initializers
Use new in initializers
2 parents 5d44eb9 + 8df257d commit b7fee09

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎src/Core.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ public static function getEnv(string $variableName): string
178178
*
179179
* @return array<string, string>
180180
*/
181-
public static function headerJSON(ClockInterface|null $clock = null): array
181+
public static function headerJSON(ClockInterface $clock = new Clock()): array
182182
{
183183
// No caching
184-
$headers = self::getNoCacheHeaders($clock ?? new Clock());
184+
$headers = self::getNoCacheHeaders($clock);
185185

186186
// Media type
187187
$headers['Content-Type'] = 'application/json; charset=UTF-8';

‎src/Header.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function getMessage(): string
326326
}
327327

328328
/** @return array<string, string> */
329-
public function getHttpHeaders(ClockInterface|null $clock = null): array
329+
public function getHttpHeaders(ClockInterface $clock = new Clock()): array
330330
{
331331
$headers = [
332332
'Referrer-Policy' => 'same-origin',
@@ -372,7 +372,7 @@ public function getHttpHeaders(ClockInterface|null $clock = null): array
372372
'Permissions-Policy' => 'fullscreen=(self), interest-cohort=()',
373373
];
374374

375-
$headers = array_merge($headers, Core::getNoCacheHeaders($clock ?? new Clock()));
375+
$headers = array_merge($headers, Core::getNoCacheHeaders($clock));
376376

377377
/**
378378
* A different Content-Type is set in {@see \PhpMyAdmin\Controllers\Transformation\WrapperController}.

‎tests/unit/Plugins/Import/ImportLdiTest.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,10 @@ public function testDoImportLDISetting(): void
200200
self::assertTrue(ImportSettings::$finished);
201201
}
202202

203-
private function getImportLdi(DatabaseInterface|null $dbi = null, Config|null $config = null): ImportLdi
203+
private function getImportLdi(DatabaseInterface|null $dbi = null, Config $config = new Config()): ImportLdi
204204
{
205205
$dbiObject = $dbi ?? $this->createDatabaseInterface();
206-
$configObject = $config ?? new Config();
207206

208-
return new ImportLdi(new Import($dbiObject, new ResponseRenderer(), $configObject), $dbiObject, $configObject);
207+
return new ImportLdi(new Import($dbiObject, new ResponseRenderer(), $config), $dbiObject, $config);
209208
}
210209
}

0 commit comments

Comments
 (0)