Skip to content

Commit

Permalink
Remove invalid inline doc comments
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Apr 18, 2021
1 parent b4effdd commit 59e4dae
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 38 deletions.
1 change: 0 additions & 1 deletion libraries/classes/Core.php
Expand Up @@ -356,7 +356,6 @@ public static function warnMissingExtension(
bool $fatal = false,
string $extra = ''
): void {
/** @var ErrorHandler $errorHandler */
global $errorHandler;

/* Gettext does not have to be loaded yet here */
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Database/Designer.php
Expand Up @@ -150,7 +150,6 @@ public function getHtmlForSchemaExport($db, $page)
*/
private function getSideMenuParamsArray()
{
/** @var DatabaseInterface $dbi */
global $dbi;

$params = [];
Expand Down
4 changes: 0 additions & 4 deletions libraries/classes/Menu.php
Expand Up @@ -124,7 +124,6 @@ private function getMenu(): string
*/
private function getAllowedTabs($level)
{
/** @var DatabaseInterface $dbi */
global $dbi;

$cacheKey = 'menu-levels-' . $level;
Expand Down Expand Up @@ -244,7 +243,6 @@ private function getBreadcrumbs(): string
*/
private function getTableTabs()
{
/** @var DatabaseInterface $dbi */
global $route, $dbi;

$isSystemSchema = Utilities::isSystemSchema($this->db);
Expand Down Expand Up @@ -378,7 +376,6 @@ private function getTableTabs()
*/
private function getDbTabs()
{
/** @var DatabaseInterface $dbi */
global $route, $dbi;

$isSystemSchema = Utilities::isSystemSchema($this->db);
Expand Down Expand Up @@ -502,7 +499,6 @@ private function getDbTabs()
*/
private function getServerTabs()
{
/** @var DatabaseInterface $dbi */
global $route, $dbi;

$isSuperUser = $dbi->isSuperUser();
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Navigation/NavigationTree.php
Expand Up @@ -1253,7 +1253,6 @@ private function renderNode(Node $node, bool $recursive, string $class = ''): st
$icons = [$icons];
}

/** @var array $icons */
if (count($icons) > 1) {
// Generates: .second double class for NavigationTreeDefaultTabTable2
$divClass = 'second double';
Expand Down
4 changes: 0 additions & 4 deletions libraries/classes/Navigation/Nodes/Node.php
Expand Up @@ -387,7 +387,6 @@ public function getData($type, $pos, $searchClause = '')
*/
public function getPresence($type = '', $searchClause = '')
{
/** @var DatabaseInterface $dbi */
global $dbi;

if (
Expand Down Expand Up @@ -508,7 +507,6 @@ private function isHideDb($db)
*/
private function getDatabasesToSearch($searchClause)
{
/** @var DatabaseInterface $dbi */
global $dbi;

$databases = [];
Expand Down Expand Up @@ -538,7 +536,6 @@ private function getDatabasesToSearch($searchClause)
*/
private function getWhereClause($columnName, $searchClause = '')
{
/** @var DatabaseInterface $dbi */
global $dbi;

$whereClause = 'WHERE TRUE ';
Expand Down Expand Up @@ -646,7 +643,6 @@ public function getIcon($match): string
*/
public function getNavigationHidingData()
{
/** @var DatabaseInterface $dbi */
global $dbi;

$cfgRelation = $this->relation->getRelationsParam();
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Plugins/Export/ExportJson.php
Expand Up @@ -216,7 +216,6 @@ public function exportData(
$sqlQuery,
array $aliases = []
) {
/** @var DatabaseInterface $dbi */
global $dbi;

$db_alias = $db;
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Plugins/Export/ExportOds.php
Expand Up @@ -216,7 +216,6 @@ public function exportData(
$sqlQuery,
array $aliases = []
) {
/** @var DatabaseInterface $dbi */
global $what, $dbi;

$db_alias = $db;
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Plugins/Export/ExportOdt.php
Expand Up @@ -246,7 +246,6 @@ public function exportData(
$sqlQuery,
array $aliases = []
) {
/** @var DatabaseInterface $dbi */
global $what, $dbi;

$db_alias = $db;
Expand Down
2 changes: 0 additions & 2 deletions libraries/classes/Plugins/Export/ExportSql.php
Expand Up @@ -2356,7 +2356,6 @@ public function exportData(
$sqlQuery,
array $aliases = []
) {
/** @var DatabaseInterface $dbi */
global $current_row, $sql_backquotes, $dbi;

// Do not export data for merge tables
Expand Down Expand Up @@ -2416,7 +2415,6 @@ public function exportData(
}

if ($result == false) {
/** @var mixed $result */
$dbi->freeResult($result);// This makes no sense

return true;
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Plugins/Export/Helpers/Pdf.php
Expand Up @@ -761,7 +761,6 @@ public function getTableDef(
*/
public function mysqlReport($query)
{
/** @var DatabaseInterface $dbi */
global $dbi;

unset(
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/ReplicationGui.php
Expand Up @@ -509,7 +509,6 @@ public function handleControlRequest()
*/
public function handleRequestForSlaveChangeMaster()
{
/** @var DatabaseInterface $dbi */
global $dbi;

$sr = [
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Routing.php
Expand Up @@ -86,7 +86,6 @@ private static function routesCachedDispatcher(callable $routeDefinitionCallback
);
$routeDefinitionCallback($routeCollector);

/** @var RouteCollector $routeCollector */
$dispatchData = $routeCollector->getData();
$canWriteCache = self::canWriteCache();

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Server/SysInfo/Linux.php
Expand Up @@ -91,6 +91,7 @@ public function memory()
$matches
);

/** @var array<string, int>|false $mem */
$mem = array_combine($matches[1], $matches[2]);
if ($mem === false) {
return [];
Expand All @@ -112,7 +113,6 @@ public function memory()
$mem[$idx] = intval($value);
}

/** @var array<string, int> $mem */
$mem['MemUsed'] = $mem['MemTotal'] - $mem['MemFree'] - $mem['Cached'] - $mem['Buffers'];
$mem['SwapUsed'] = $mem['SwapTotal'] - $mem['SwapFree'] - $mem['SwapCached'];

Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Tracker.php
Expand Up @@ -539,7 +539,6 @@ public static function deactivateTracking($dbname, $tablename, $version)
*/
public static function getVersion($dbname, $tablename, $statement = null)
{
/** @var DatabaseInterface $dbi */
global $dbi;

$relation = new Relation($dbi);
Expand Down
4 changes: 0 additions & 4 deletions libraries/classes/Utils/ForeignKey.php
Expand Up @@ -4,8 +4,6 @@

namespace PhpMyAdmin\Utils;

use PhpMyAdmin\DatabaseInterface;

use function strtolower;
use function strtoupper;
use function substr;
Expand Down Expand Up @@ -66,7 +64,6 @@ public static function isCheckEnabled(): bool
*/
public static function handleDisableCheckInit(): bool
{
/** @var DatabaseInterface $dbi */
global $dbi;

$defaultCheckValue = $dbi->getVariable('FOREIGN_KEY_CHECKS') === 'ON';
Expand All @@ -90,7 +87,6 @@ public static function handleDisableCheckInit(): bool
*/
public static function handleDisableCheckCleanup(bool $defaultCheckValue): void
{
/** @var DatabaseInterface $dbi */
global $dbi;

$dbi->setVariable(
Expand Down
9 changes: 7 additions & 2 deletions phpstan-baseline.neon
Expand Up @@ -916,9 +916,14 @@ parameters:
path: libraries/classes/Menu.php

-
message: "#^Method PhpMyAdmin\\\\Navigation\\\\Nodes\\\\Node\\:\\:getPresence\\(\\) should return int but returns int\\|string\\.$#"
message: "#^Argument of an invalid type array\\|string supplied for foreach, only iterables are supported\\.$#"
count: 1
path: libraries/classes/Navigation/Nodes/Node.php
path: libraries/classes/Navigation/NavigationTree.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\|string given\\.$#"
count: 1
path: libraries/classes/Navigation/NavigationTree.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
Expand Down
6 changes: 6 additions & 0 deletions psalm-baseline.xml
Expand Up @@ -1223,6 +1223,12 @@
<PossiblyFalseReference occurrences="1">
<code>getPresence</code>
</PossiblyFalseReference>
<PossiblyInvalidArgument occurrences="1">
<code>$icons</code>
</PossiblyInvalidArgument>
<PossiblyInvalidIterator occurrences="1">
<code>$icons</code>
</PossiblyInvalidIterator>
<PossiblyNullArgument occurrences="2">
<code>$container-&gt;realName</code>
<code>$table</code>
Expand Down
3 changes: 2 additions & 1 deletion test/classes/AbstractTestCase.php
Expand Up @@ -106,9 +106,10 @@ protected function loadResponseIntoContainerBuilder(): void
protected function getResponseHtmlResult(): string
{
global $containerBuilder;
$response = $containerBuilder->get(Response::class);

/** @var Response $response */
$response = $containerBuilder->get(Response::class);

return $response->getHTMLResult();
}

Expand Down
1 change: 0 additions & 1 deletion test/classes/DatabaseInterfaceTest.php
Expand Up @@ -49,7 +49,6 @@ public function testGetCurrentUser($value, string $string, array $expected): voi
SessionCache::remove('mysql_cur_user');

$extension = new DbiDummy();
/** @var array $value */
$extension->setResult('SELECT CURRENT_USER();', $value);

$dbi = new DatabaseInterface($extension);
Expand Down
4 changes: 2 additions & 2 deletions test/classes/Stubs/DbiDummy.php
Expand Up @@ -434,8 +434,8 @@ public function escapeString($link, $str)
/**
* Adds query result for testing
*
* @param string $query SQL
* @param array $result Expected result
* @param string $query SQL
* @param array|false $result Expected result
*
* @return void
*/
Expand Down
2 changes: 0 additions & 2 deletions test/classes/TableTest.php
Expand Up @@ -988,7 +988,6 @@ public function testIsMergeCase1(): void
*/
public function testIsMergeCase2(): void
{
/** @var DatabaseInterface $dbi */
global $dbi;

$dbi->getCache()->cacheTableContent(
Expand All @@ -1007,7 +1006,6 @@ public function testIsMergeCase2(): void
*/
public function testIsMergeCase3(): void
{
/** @var DatabaseInterface $dbi */
global $dbi;

$dbi->getCache()->cacheTableContent(
Expand Down
5 changes: 0 additions & 5 deletions test/classes/VersionInformationTest.php
Expand Up @@ -203,7 +203,6 @@ public function testGetLatestCompatibleVersionWithSingleServer(): void
true
);

/** @var VersionInformation $mockVersionInfo */
$compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
$this->assertIsArray($compatible);
$this->assertEquals('4.4.14.1', $compatible['version']);
Expand Down Expand Up @@ -234,7 +233,6 @@ public function testGetLatestCompatibleVersionWithMultipleServers(): void
true
);

/** @var VersionInformation $mockVersionInfo */
$compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
$this->assertIsArray($compatible);
$this->assertEquals('4.4.14.1', $compatible['version']);
Expand Down Expand Up @@ -269,7 +267,6 @@ public function testGetLatestCompatibleVersionWithOldPHPVersion(): void
true
);

/** @var VersionInformation $mockVersionInfo */
$compatible = $mockVersionInfo->getLatestCompatibleVersion($this->releases);
$this->assertIsArray($compatible);
$this->assertEquals('4.0.10.10', $compatible['version']);
Expand Down Expand Up @@ -315,7 +312,6 @@ public function testGetLatestCompatibleVersionWithNewPHPVersion(
...$returnValues
);

/** @var VersionInformation $mockVersionInfo */
$compatible = $mockVersionInfo->getLatestCompatibleVersion($versions);
$this->assertEquals($matchedLastVersion, $compatible['version'] ?? null);
}
Expand Down Expand Up @@ -574,7 +570,6 @@ public function testEvaluateVersionCondition(): void
->method('getPHPVersion')
->will($this->returnValue('5.2.4'));

/** @var VersionInformation $mockVersionInfo */
$this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '<=5.3'));
$this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '<5.3'));
$this->assertTrue($mockVersionInfo->evaluateVersionCondition('PHP', '>=5.2'));
Expand Down

0 comments on commit 59e4dae

Please sign in to comment.