Enable checkTooWideReturnTypesInProtectedAndPublicMethods

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-02-14 21:18:29 +00:00
parent 51a855a5cc
commit affd2b9d7f
4 changed files with 23 additions and 2 deletions

View File

@ -13,6 +13,7 @@ use PhpMyAdmin\FieldMetadata;
use Webmozart\Assert\Assert;
use function array_column;
use function array_key_exists;
use function is_array;
use function is_bool;
use function is_string;
@ -104,7 +105,11 @@ final class MysqliResult implements ResultInterface
$row = $this->fetchRow();
}
return $row[$field] ?? false;
if (! array_key_exists($field, $row)) {
return false;
}
return $row[$field];
}
/**

View File

@ -6910,6 +6910,11 @@ parameters:
count: 1
path: libraries/classes/Plugins/Import/ImportXml.php
-
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\ShapeFileImport\\:\\:readSHP\\(\\) never returns false so it can be removed from the return type\\.$#"
count: 1
path: libraries/classes/Plugins/Import/ShapeFileImport.php
-
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\Upload\\\\UploadNoplugin\\:\\:getUploadStatus\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
@ -11805,6 +11810,11 @@ parameters:
count: 1
path: test/classes/StorageEngineTest.php
-
message: "#^Method PhpMyAdmin\\\\Tests\\\\Stubs\\\\DbiDummy\\:\\:connect\\(\\) never returns null so it can be removed from the return type\\.$#"
count: 1
path: test/classes/Stubs/DbiDummy.php
-
message: "#^Method PhpMyAdmin\\\\Tests\\\\Stubs\\\\DbiDummy\\:\\:fetchAny\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1

View File

@ -35,3 +35,4 @@ parameters:
checkUninitializedProperties: true
polluteScopeWithAlwaysIterableForeach: true
checkDynamicProperties: true
checkTooWideReturnTypesInProtectedAndPublicMethods: true

View File

@ -12,6 +12,7 @@ use PhpMyAdmin\Dbal\ResultInterface;
use PhpMyAdmin\FieldMetadata;
use function array_column;
use function array_key_exists;
use function is_string;
/**
@ -103,7 +104,11 @@ class DummyResult implements ResultInterface
$row = $this->fetchRow();
}
return $row[$field] ?? false;
if (! array_key_exists($field, $row)) {
return false;
}
return $row[$field];
}
/**