Skip to content

Commit e515ecd

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2 parents 7567aec + c535939 commit e515ecd

4 files changed

Lines changed: 4 additions & 17 deletions

File tree

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5394,12 +5394,6 @@ parameters:
53945394
count: 1
53955395
path: src/Dbal/DatabaseInterface.php
53965396

5397-
-
5398-
message: '#^Variable \$roleHost on left side of \?\? always exists and is not nullable\.$#'
5399-
identifier: nullCoalesce.variable
5400-
count: 2
5401-
path: src/Dbal/DatabaseInterface.php
5402-
54035397
-
54045398
message: '''
54055399
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:

psalm-baseline.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,10 +3607,6 @@
36073607
<DeprecatedProperty>
36083608
<code><![CDATA[Routing::$route]]></code>
36093609
</DeprecatedProperty>
3610-
<DocblockTypeContradiction>
3611-
<code><![CDATA['']]></code>
3612-
<code><![CDATA['']]></code>
3613-
</DocblockTypeContradiction>
36143610
<InvalidOperand>
36153611
<code><![CDATA[$row['Data_free']]]></code>
36163612
<code><![CDATA[$row['Data_length']]]></code>
@@ -3724,10 +3720,6 @@
37243720
<PossiblyUnusedReturnValue>
37253721
<code><![CDATA[bool]]></code>
37263722
</PossiblyUnusedReturnValue>
3727-
<RedundantConditionGivenDocblockType>
3728-
<code><![CDATA[$roleHost]]></code>
3729-
<code><![CDATA[$roleHost]]></code>
3730-
</RedundantConditionGivenDocblockType>
37313723
<RiskyTruthyFalsyComparison>
37323724
<code><![CDATA[$index->isUnique()]]></code>
37333725
<code><![CDATA[$limitCount]]></code>

src/Dbal/DatabaseInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ public function isGrantUser(): bool
14531453

14541454
if (! $hasGrantPrivilege) {
14551455
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
1456-
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost ?? '', $collation);
1456+
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost, $collation);
14571457
$hasGrantPrivilege = (bool) $this->fetchValue($query);
14581458

14591459
if ($hasGrantPrivilege) {
@@ -1502,7 +1502,7 @@ public function isCreateUser(): bool
15021502

15031503
if (! $hasCreatePrivilege) {
15041504
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
1505-
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost ?? '', $collation);
1505+
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost, $collation);
15061506
$hasCreatePrivilege = (bool) $this->fetchValue($query);
15071507

15081508
if ($hasCreatePrivilege) {
@@ -1556,7 +1556,7 @@ public function getCurrentRolesAndHost(): array
15561556
$roles = $this->getCurrentRoles();
15571557

15581558
$this->currentRoleAndHost = array_map(static function (string $role) {
1559-
return explode('@', $role);
1559+
return str_contains($role, '@') ? explode('@', $role) : [$role, ''];
15601560
}, $roles);
15611561
}
15621562

tests/unit/Dbal/DatabaseInterfaceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public static function currentRolesData(): array
158158
],
159159
['8.0.0 - MySQL Community Server - GPL', true, [['@`localhost`']], ['@localhost'], [['', 'localhost']]],
160160
['10.5.0-MariaDB', true, [['`role`@`localhost`']], ['role@localhost'], [['role', 'localhost']]],
161+
['10.5.0-MariaDB', true, [['`role`']], ['role'], [['role', '']]],
161162
[
162163
'10.5.0-MariaDB',
163164
true,

0 commit comments

Comments
 (0)