Remove $table global from ignored errors for PHPStan

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-05-14 15:17:57 -03:00
parent 45546661aa
commit 82a03931d6
21 changed files with 36 additions and 38 deletions

View File

@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -19,7 +19,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -31,7 +31,7 @@ if (isset($_POST['format']) && $_POST['format'] == 'ldi') {
define('PMA_ENABLE_LDI', 1);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -17,7 +17,7 @@ if (! defined('PHPMYADMIN')) {
exit;
}
global $db;
global $db, $table;
if (empty($is_db)) {
if (strlen($db) > 0) {

View File

@ -18,7 +18,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -15,7 +15,7 @@ parameters:
- '#Access to an undefined property PhpMyAdmin\\TwoFactor\:\:\$(backend|showSubmit|available|writable)#'
- '#Call to an undefined method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:getHiddenCount#'
- '#Undefined variable: \$array#'
- '#Undefined variable: \$(table|url_query|text_dir|server|pmaThemeImage|action|sql_query|lang|export_type|err_url|collation_connection|filename_template|transform_key|cn|goto|partitionDetails|token_mismatch|auth_plugin|username|hostname|display_query|where_clause)#'#Others
- '#Undefined variable: \$(url_query|text_dir|server|pmaThemeImage|action|sql_query|lang|export_type|err_url|collation_connection|filename_template|transform_key|cn|goto|partitionDetails|token_mismatch|auth_plugin|username|hostname|display_query|where_clause)#'#Others
- '#Undefined variable: \$(unsaved_values|is_upload)#'#tbl_change.php
- '#Undefined variable: \$max_upload_size#'#tbl_import.php
- '#Undefined variable: \$(repobase|fullrevision|revision|repobranchbase|branch)#'#Footer.php

View File

@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';
require_once ROOT_PATH . 'libraries/server_common.inc.php';

View File

@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $cfg, $db;
global $cfg, $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $cfg, $db;
global $cfg, $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $cfg, $db;
global $cfg, $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -17,7 +17,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -23,7 +23,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';
@ -43,12 +43,10 @@ $checkUserPrivileges->getPrivileges();
$lowerCaseNames = $dbi->getLowerCaseNames() === '1';
if ($lowerCaseNames) {
$GLOBALS['table'] = mb_strtolower(
$GLOBALS['table']
);
$table = mb_strtolower($table);
}
$pma_table = new Table($GLOBALS['table'], $db);
$pma_table = new Table($table, $db);
$header = $response->getHeader();
$scripts = $header->getScripts();
@ -78,7 +76,7 @@ $dbi->selectDb($db);
*/
$pma_table = $dbi->getTable(
$db,
$GLOBALS['table']
$table
);
$reread_info = $pma_table->getStatusInfo(null, false);
$GLOBALS['showtable'] = $pma_table->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
@ -112,7 +110,7 @@ if ($pma_table->isEngine('ARIA')) {
$pma_table = $dbi->getTable(
$db,
$GLOBALS['table']
$table
);
$reread_info = false;
$table_alters = [];
@ -168,7 +166,7 @@ if (isset($_POST['submitoptions'])) {
$dbi->selectDb($oldDb);
$_message .= $pma_table->getLastMessage();
$result = true;
$GLOBALS['table'] = $pma_table->getName();
$table = $pma_table->getName();
$reread_info = true;
$reload = true;
} else {
@ -210,7 +208,7 @@ if (isset($_POST['submitoptions'])) {
if (count($table_alters) > 0) {
$sql_query = 'ALTER TABLE '
. Util::backquote($GLOBALS['table']);
. Util::backquote($table);
$sql_query .= "\r\n" . implode("\r\n", $table_alters);
$sql_query .= ';';
$result = $dbi->query($sql_query) ? true : false;
@ -226,7 +224,7 @@ if (isset($_POST['submitoptions'])) {
) {
$operations->changeAllColumnsCollation(
$db,
$GLOBALS['table'],
$table,
$_POST['tbl_collation']
);
}
@ -334,7 +332,7 @@ $url_params['goto']
/**
* Get columns names
*/
$columns = $dbi->getColumns($db, $GLOBALS['table']);
$columns = $dbi->getColumns($db, $table);
/**
* Displays the page
@ -348,7 +346,7 @@ $hideOrderTable = false;
// a user-defined clustered index (PRIMARY KEY or NOT NULL UNIQUE index).
// InnoDB always orders table rows according to such an index if one is present.
if ($tbl_storage_engine == 'INNODB') {
$indexes = Index::getFromTable($GLOBALS['table'], $db);
$indexes = Index::getFromTable($table, $db);
foreach ($indexes as $name => $idx) {
if ($name == 'PRIMARY') {
$hideOrderTable = true;
@ -433,7 +431,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) {
&& ! (isset($db_is_system_schema) && $db_is_system_schema)
) {
$this_sql_query = 'TRUNCATE TABLE '
. Util::backquote($GLOBALS['table']);
. Util::backquote($table);
$truncate_table_url_params = array_merge(
$url_params,
[
@ -449,7 +447,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) {
}
if (! (isset($db_is_system_schema) && $db_is_system_schema)) {
$this_sql_query = 'DROP TABLE '
. Util::backquote($GLOBALS['table']);
. Util::backquote($table);
$drop_table_url_params = array_merge(
$url_params,
[
@ -466,7 +464,7 @@ if (! (isset($db_is_system_schema) && $db_is_system_schema)) {
),
// table name is needed to avoid running
// PhpMyAdmin\RelationCleanup::database() on the whole db later
'table' => $GLOBALS['table'],
'table' => $table,
]
);
}
@ -497,7 +495,7 @@ unset($partition_names);
if ($cfgRelation['relwork'] && ! $pma_table->isEngine("INNODB")) {
$dbi->selectDb($db);
$foreign = $relation->getForeigners($db, $GLOBALS['table'], '', 'internal');
$foreign = $relation->getForeigners($db, $table, '', 'internal');
if (! empty($foreign)) {
$response->addHTML(

View File

@ -30,7 +30,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db, $url_params;
global $db, $table, $url_params;
require_once ROOT_PATH . 'libraries/common.inc.php';
@ -154,7 +154,7 @@ if ($dbi->getVersion() >= 50600) {
}
//if some posted fields need to be transformed.
$mime_map = $transformations->getMime($db, $GLOBALS['table']);
$mime_map = $transformations->getMime($db, $table);
if ($mime_map === false) {
$mime_map = [];
}
@ -340,7 +340,7 @@ foreach ($loop_array as $rownumber => $where_clause) {
$value_sets[] = implode(', ', $query_values);
} else {
// build update query
$query[] = 'UPDATE ' . Util::backquote($GLOBALS['table'])
$query[] = 'UPDATE ' . Util::backquote($table)
. ' SET ' . implode(', ', $query_values)
. ' WHERE ' . $where_clause
. ($_POST['clause_is_unique'] ? '' : ' LIMIT 1');

View File

@ -15,7 +15,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -16,7 +16,7 @@ if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';

View File

@ -20,7 +20,7 @@ if (! defined('ROOT_PATH')) {
define('IS_TRANSFORMATION_WRAPPER', true);
global $db;
global $db, $table;
require_once ROOT_PATH . 'libraries/common.inc.php';