Skip to content

Commit d40e052

Browse files
Merge pull request #18808 from kamil-tekiela/Remove-dead-code
Remove dead code
2 parents ed86716 + d3ee2d0 commit d40e052

17 files changed

Lines changed: 19 additions & 86 deletions

phpstan-baseline.neon

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,6 @@ parameters:
385385
count: 2
386386
path: src/Config.php
387387

388-
-
389-
message: "#^Casting to string something that's already string\\.$#"
390-
count: 1
391-
path: src/Config.php
392-
393388
-
394389
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
395390
count: 8
@@ -8280,11 +8275,6 @@ parameters:
82808275
count: 1
82818276
path: src/Core.php
82828277

8283-
-
8284-
message: "#^Casting to string something that's already string\\.$#"
8285-
count: 1
8286-
path: src/Core.php
8287-
82888278
-
82898279
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
82908280
count: 3
@@ -11402,7 +11392,7 @@ parameters:
1140211392

1140311393
-
1140411394
message: "#^Casting to int something that's already int\\.$#"
11405-
count: 2
11395+
count: 1
1140611396
path: src/Import/Import.php
1140711397

1140811398
-
@@ -20255,11 +20245,6 @@ parameters:
2025520245
count: 1
2025620246
path: test/classes/Gis/GisPolygonTest.php
2025720247

20258-
-
20259-
message: "#^Casting to string something that's already string\\.$#"
20260-
count: 1
20261-
path: test/classes/HeaderTest.php
20262-
2026320248
-
2026420249
message: "#^Property PhpMyAdmin\\\\Config\\:\\:\\$settings \\(array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\) does not accept array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\.$#"
2026520250
count: 1

psalm-baseline.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4483,9 +4483,6 @@
44834483
<PossiblyUnusedParam>
44844484
<code>$array</code>
44854485
</PossiblyUnusedParam>
4486-
<RedundantCast>
4487-
<code>(string) gmdate(DATE_RFC1123)</code>
4488-
</RedundantCast>
44894486
<UnsupportedReferenceUsage>
44904487
<code><![CDATA[$path[$depth] =& $path[$depth - 1][$key]]]></code>
44914488
</UnsupportedReferenceUsage>
@@ -14592,9 +14589,6 @@
1459214589
<code><![CDATA[$config->settings]]></code>
1459314590
<code><![CDATA[$config->settings]]></code>
1459414591
</PropertyTypeCoercion>
14595-
<RedundantCast>
14596-
<code>(string) gmdate(DATE_RFC1123)</code>
14597-
</RedundantCast>
1459814592
</file>
1459914593
<file src="test/classes/Html/GeneratorTest.php">
1460014594
<DeprecatedMethod>

src/Charsets/Charset.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ private function __construct(
2929
/**
3030
* @param string[] $state State obtained from the database server
3131
* @psalm-param array{Charset?:string, Description?:string, 'Default collation'?:string, Maxlen?:string} $state
32-
*
33-
* @return Charset
3432
*/
3533
public static function fromServer(array $state): self
3634
{

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ public function checkUpload(): void
722722
$this->set('enable_upload', true);
723723
// if set "php_admin_value file_uploads Off" in httpd.conf
724724
// ini_get() also returns the string "Off" in this case:
725-
if (strtolower((string) ini_get('file_uploads')) !== 'off') {
725+
if (strtolower(ini_get('file_uploads')) !== 'off') {
726726
return;
727727
}
728728

src/Config/Settings/Server.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,7 @@ public function asArray(): array
10431043
];
10441044
}
10451045

1046-
/** @return static */
1047-
public function withSSL(bool $ssl): Server
1046+
public function withSSL(bool $ssl): static
10481047
{
10491048
$clone = clone $this;
10501049
$clone->ssl = $ssl;

src/Controllers/Import/ImportController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ public function __invoke(ServerRequest $request): void
315315
// Bookmark Support: get a query back from bookmark if required
316316
$idBookmark = (int) $request->getParsedBodyParam('id_bookmark');
317317
$actionBookmark = (int) $request->getParsedBodyParam('action_bookmark');
318-
$config = $config;
319318
if ($idBookmark !== 0) {
320319
switch ($actionBookmark) {
321320
case 0: // bookmarked query that have to be run

src/Core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public static function headerJSON(): array
252252
public static function getNoCacheHeaders(): array
253253
{
254254
$headers = [];
255-
$date = (string) gmdate(DATE_RFC1123);
255+
$date = gmdate(DATE_RFC1123);
256256

257257
// rfc2616 - Section 14.21
258258
$headers['Expires'] = $date;

src/Gis/Ds/Polygon.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public function area(): float
4646
$area -= $this[$i]->y * $this[$j]->x;
4747
}
4848

49-
$area /= 2.0;
50-
51-
return $area;
49+
return $area / 2.0;
5250
}
5351

5452
/**

src/Http/Middleware/CurrentServerGlobalSetting.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
namespace PhpMyAdmin\Http\Middleware;
66

77
use PhpMyAdmin\Config;
8-
use PhpMyAdmin\Core;
98
use PhpMyAdmin\Http\ServerRequest;
109
use Psr\Http\Message\ResponseInterface;
1110
use Psr\Http\Message\ServerRequestInterface;
1211
use Psr\Http\Server\MiddlewareInterface;
1312
use Psr\Http\Server\RequestHandlerInterface;
14-
use Symfony\Component\DependencyInjection\ContainerInterface;
1513

1614
use function assert;
1715

@@ -24,14 +22,12 @@ public function __construct(private readonly Config $config)
2422
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
2523
{
2624
assert($request instanceof ServerRequest);
27-
$container = Core::getContainerBuilder();
28-
$this->setCurrentServerGlobal($container, $this->config, $request->getParam('server'));
25+
$this->setCurrentServerGlobal($this->config, $request->getParam('server'));
2926

3027
return $handler->handle($request);
3128
}
3229

3330
private function setCurrentServerGlobal(
34-
ContainerInterface $container,
3531
Config $config,
3632
mixed $serverParamFromRequest,
3733
): void {

src/Http/Middleware/DatabaseAndTableSetting.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
namespace PhpMyAdmin\Http\Middleware;
66

7-
use PhpMyAdmin\Core;
87
use PhpMyAdmin\Http\ServerRequest;
98
use PhpMyAdmin\Identifiers\DatabaseName;
109
use PhpMyAdmin\Identifiers\TableName;
1110
use Psr\Http\Message\ResponseInterface;
1211
use Psr\Http\Message\ServerRequestInterface;
1312
use Psr\Http\Server\MiddlewareInterface;
1413
use Psr\Http\Server\RequestHandlerInterface;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1614

1715
use function assert;
1816
use function is_array;
@@ -22,13 +20,12 @@ final class DatabaseAndTableSetting implements MiddlewareInterface
2220
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
2321
{
2422
assert($request instanceof ServerRequest);
25-
$container = Core::getContainerBuilder();
26-
$this->setDatabaseAndTableFromRequest($container, $request);
23+
$this->setDatabaseAndTableFromRequest($request);
2724

2825
return $handler->handle($request);
2926
}
3027

31-
private function setDatabaseAndTableFromRequest(ContainerInterface $container, ServerRequest $request): void
28+
private function setDatabaseAndTableFromRequest(ServerRequest $request): void
3229
{
3330
$GLOBALS['urlParams'] ??= null;
3431

0 commit comments

Comments
 (0)