Skip to content

Commit 84be8f6

Browse files
Merge pull request #20417 from kamil-tekiela/Rector-fixes
Rector fixes
2 parents 3b4defe + d149194 commit 84be8f6

26 files changed

Lines changed: 60 additions & 116 deletions

‎phpstan-baseline.neon‎

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14439,12 +14439,6 @@ parameters:
1443914439
count: 2
1444014440
path: tests/unit/Controllers/NavigationControllerTest.php
1444114441

14442-
-
14443-
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
14444-
identifier: argument.type
14445-
count: 4
14446-
path: tests/unit/Controllers/NavigationControllerTest.php
14447-
1444814442
-
1444914443
message: '''
1445014444
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@@ -14532,12 +14526,6 @@ parameters:
1453214526
count: 1
1453314527
path: tests/unit/Controllers/Server/Databases/CreateControllerTest.php
1453414528

14535-
-
14536-
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
14537-
identifier: argument.type
14538-
count: 3
14539-
path: tests/unit/Controllers/Server/Databases/CreateControllerTest.php
14540-
1454114529
-
1454214530
message: '''
1454314531
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@@ -14553,12 +14541,6 @@ parameters:
1455314541
count: 1
1455414542
path: tests/unit/Controllers/Server/Databases/DestroyControllerTest.php
1455514543

14556-
-
14557-
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
14558-
identifier: argument.type
14559-
count: 2
14560-
path: tests/unit/Controllers/Server/Databases/DestroyControllerTest.php
14561-
1456214544
-
1456314545
message: '''
1456414546
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@@ -17014,15 +16996,9 @@ parameters:
1701416996
path: tests/unit/Utils/HttpRequestTest.php
1701516997

1701616998
-
17017-
message: '#^Parameter \#1 \$needle of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
16999+
message: '#^Parameter \#1 \$result of method PhpMyAdmin\\Tests\\Utils\\HttpRequestTest\:\:validateHttp\(\) expects bool\|string\|null, mixed given\.$#'
1701817000
identifier: argument.type
17019-
count: 1
17020-
path: tests/unit/Utils/HttpRequestTest.php
17021-
17022-
-
17023-
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
17024-
identifier: argument.type
17025-
count: 1
17001+
count: 4
1702617002
path: tests/unit/Utils/HttpRequestTest.php
1702717003

1702817004
-

‎psalm-baseline.xml‎

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9145,14 +9145,6 @@
91459145
<code><![CDATA[Config::getInstance()]]></code>
91469146
<code><![CDATA[Config::getInstance()]]></code>
91479147
</DeprecatedMethod>
9148-
<MixedArgument>
9149-
<code><![CDATA[$responseMessage]]></code>
9150-
<code><![CDATA[$responseMessage]]></code>
9151-
</MixedArgument>
9152-
<MixedAssignment>
9153-
<code><![CDATA[$responseMessage]]></code>
9154-
<code><![CDATA[$responseMessage]]></code>
9155-
</MixedAssignment>
91569148
</file>
91579149
<file src="tests/unit/Controllers/Normalization/AddNewPrimaryControllerTest.php">
91589150
<DeprecatedMethod>
@@ -9192,20 +9184,11 @@
91929184
<DeprecatedMethod>
91939185
<code><![CDATA[Config::getInstance()]]></code>
91949186
</DeprecatedMethod>
9195-
<MixedArgument>
9196-
<code><![CDATA[$actual['message']]]></code>
9197-
<code><![CDATA[$actual['message']]]></code>
9198-
<code><![CDATA[$actual['message']]]></code>
9199-
</MixedArgument>
92009187
</file>
92019188
<file src="tests/unit/Controllers/Server/Databases/DestroyControllerTest.php">
92029189
<DeprecatedMethod>
92039190
<code><![CDATA[Config::getInstance()]]></code>
92049191
</DeprecatedMethod>
9205-
<MixedArgument>
9206-
<code><![CDATA[$actual['message']]]></code>
9207-
<code><![CDATA[$actual['message']]]></code>
9208-
</MixedArgument>
92099192
</file>
92109193
<file src="tests/unit/Controllers/Server/DatabasesControllerTest.php">
92119194
<DeprecatedMethod>
@@ -10658,7 +10641,9 @@
1065810641
<MixedArgument>
1065910642
<code><![CDATA[$curl['ssl_version']]]></code>
1066010643
<code><![CDATA[$curl['ssl_version']]]></code>
10661-
<code><![CDATA[$expected]]></code>
10644+
<code><![CDATA[$result]]></code>
10645+
<code><![CDATA[$result]]></code>
10646+
<code><![CDATA[$result]]></code>
1066210647
<code><![CDATA[$result]]></code>
1066310648
</MixedArgument>
1066410649
<MixedAssignment>

‎tests/end-to-end/Table/BrowseTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ public function testChangeRecordsByDoubleClick(): void
187187
$this->doubleclick();
188188

189189
self::assertSame(
190+
'abcd',
190191
$this->waitForElement(
191192
'xpath',
192193
"//div[not(contains(@style,'display: none;'))]//textarea[contains(@class, 'edit_box')]",
193194
)->getAttribute('value'),
194-
'abcd',
195195
);
196196

197197
$this->byCssSelector('textarea.edit_box')->clear();

‎tests/unit/Config/FormDisplayTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testDisplayErrors(): void
114114

115115
$result = $this->object->displayErrors();
116116

117-
self::assertSame($result, '');
117+
self::assertSame('', $result);
118118

119119
$arr = ['Servers/1/test' => ['e1'], 'foobar' => ['e2', 'e3']];
120120

‎tests/unit/ConfigTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testLoadConfigs(): void
9696
$defaultConfig->set('environment', 'development');
9797
self::assertSame($defaultConfig->settings, $config->settings);
9898
self::assertArrayHasKey('environment', $config->settings);
99-
self::assertSame($config->settings['environment'], 'development');
99+
self::assertSame('development', $config->settings['environment']);
100100
self::assertArrayNotHasKey('UnknownKey', $config->settings);
101101
self::assertEquals($defaultConfig->getSettings(), $config->getSettings());
102102

‎tests/unit/Controllers/CheckRelationsControllerTest.php‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
1515
use PhpMyAdmin\Http\ServerRequest;
1616
use PhpMyAdmin\Tests\AbstractTestCase;
17-
use PhpMyAdmin\Tests\Stubs\DbiDummy;
1817
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
1918
use PhpMyAdmin\Tracking\Tracker;
2019
use PHPUnit\Framework\Attributes\CoversClass;
@@ -26,14 +25,12 @@ final class CheckRelationsControllerTest extends AbstractTestCase
2625
{
2726
protected DatabaseInterface $dbi;
2827

29-
protected DbiDummy $dummyDbi;
30-
3128
protected function setUp(): void
3229
{
3330
parent::setUp();
3431

35-
$this->dummyDbi = $this->createDbiDummy();
36-
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
32+
$dummyDbi = $this->createDbiDummy();
33+
$this->dbi = $this->createDatabaseInterface($dummyDbi);
3734
DatabaseInterface::$instance = $this->dbi;
3835
}
3936

‎tests/unit/Controllers/Export/Template/UpdateControllerTest.php‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
1515
use PhpMyAdmin\Http\ServerRequest;
1616
use PhpMyAdmin\Tests\AbstractTestCase;
17-
use PhpMyAdmin\Tests\Stubs\DbiDummy;
1817
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
1918
use PHPUnit\Framework\Attributes\CoversClass;
2019
use ReflectionProperty;
@@ -24,14 +23,12 @@ final class UpdateControllerTest extends AbstractTestCase
2423
{
2524
private DatabaseInterface $dbi;
2625

27-
private DbiDummy $dummyDbi;
28-
2926
protected function setUp(): void
3027
{
3128
parent::setUp();
3229

33-
$this->dummyDbi = $this->createDbiDummy();
34-
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
30+
$dummyDbi = $this->createDbiDummy();
31+
$this->dbi = $this->createDatabaseInterface($dummyDbi);
3532
DatabaseInterface::$instance = $this->dbi;
3633
}
3734

‎tests/unit/Controllers/NavigationControllerTest.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function testIndex(): void
141141

142142
$responseMessage = $responseRenderer->getJSONResult()['message'];
143143

144+
self::assertIsString($responseMessage);
144145
self::assertStringContainsString('<div id=\'pma_navigation_tree_content\'>', $responseMessage);
145146

146147
// root.air-balloon_burner_dev2
@@ -293,6 +294,7 @@ public function testIndexWithPosAndValue(): void
293294

294295
$responseMessage = $responseRenderer->getJSONResult()['message'];
295296

297+
self::assertIsString($responseMessage);
296298
self::assertStringContainsString('<div id=\'pma_navigation_tree_content\'>', $responseMessage);
297299

298300
$dbTemplate = ' <li class="database database">' . "\n"

‎tests/unit/Controllers/Server/Databases/CreateControllerTest.php‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PhpMyAdmin\Dbal\DatabaseInterface;
1111
use PhpMyAdmin\Http\Factory\ServerRequestFactory;
1212
use PhpMyAdmin\Tests\AbstractTestCase;
13-
use PhpMyAdmin\Tests\Stubs\DbiDummy;
1413
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
1514
use PHPUnit\Framework\Attributes\CoversClass;
1615

@@ -22,14 +21,12 @@ final class CreateControllerTest extends AbstractTestCase
2221
{
2322
private DatabaseInterface $dbi;
2423

25-
private DbiDummy $dummyDbi;
26-
2724
protected function setUp(): void
2825
{
2926
parent::setUp();
3027

31-
$this->dummyDbi = $this->createDbiDummy();
32-
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
28+
$dummyDbi = $this->createDbiDummy();
29+
$this->dbi = $this->createDatabaseInterface($dummyDbi);
3330
DatabaseInterface::$instance = $this->dbi;
3431
}
3532

@@ -54,6 +51,7 @@ public function testCreateDatabase(): void
5451
$actual = $response->getJSONResult();
5552

5653
self::assertArrayHasKey('message', $actual);
54+
self::assertIsString($actual['message']);
5755
self::assertStringContainsString('<div class="alert alert-danger" role="alert">', $actual['message']);
5856

5957
$response = new ResponseRenderer();
@@ -71,6 +69,7 @@ public function testCreateDatabase(): void
7169
$actual = $response->getJSONResult();
7270

7371
self::assertArrayHasKey('message', $actual);
72+
self::assertIsString($actual['message']);
7473
self::assertStringContainsString('<div class="alert alert-success" role="alert">', $actual['message']);
7574
self::assertStringContainsString(
7675
sprintf(__('Database %1$s has been created.'), 'test_db'),

‎tests/unit/Controllers/Server/Databases/DestroyControllerTest.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function testDropDatabases(): void
5454
$actual = $response->getJSONResult();
5555

5656
self::assertArrayHasKey('message', $actual);
57+
self::assertIsString($actual['message']);
5758
self::assertStringContainsString('<div class="alert alert-danger" role="alert">', $actual['message']);
5859
self::assertStringContainsString(__('No databases selected.'), $actual['message']);
5960
}

0 commit comments

Comments
 (0)