Skip to content

Commit

Permalink
Fix some PHPStan errors
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 Mar 19, 2019
1 parent 21e2ca4 commit 525a436
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
12 changes: 0 additions & 12 deletions libraries/classes/Controllers/Table/StructureController.php
Expand Up @@ -91,13 +91,7 @@ class StructureController extends AbstractController
* @param \PhpMyAdmin\DatabaseInterface $dbi DatabaseInterface object
* @param string $db Database name
* @param string $table Table name
* @param string $type Indicate the db_structure or tbl_structure
* @param int $num_tables Number of tables
* @param int $pos Current position in the list
* @param bool $db_is_system_schema DB is information_schema
* @param int $total_num_tables Number of tables
* @param array $tables Tables in the DB
* @param bool $is_show_stats Whether stats show or not
* @param bool $tbl_is_view Table is a view
* @param string $tbl_storage_engine Table storage engine
* @param int $table_info_num_rows Number of rows
Expand All @@ -109,13 +103,7 @@ public function __construct(
$dbi,
$db,
$table,
$type,
$num_tables,
$pos,
$db_is_system_schema,
$total_num_tables,
$tables,
$is_show_stats,
$tbl_is_view,
$tbl_storage_engine,
$table_info_num_rows,
Expand Down
9 changes: 7 additions & 2 deletions libraries/classes/DatabaseInterface.php
Expand Up @@ -2806,11 +2806,16 @@ public function getProtoInfo($link = DatabaseInterface::CONNECT_USER)
/**
* returns a string that represents the client library version
*
* @param integer $link link type
*
* @return string MySQL client library version
*/
public function getClientInfo(): string
public function getClientInfo($link = DatabaseInterface::CONNECT_USER): string
{
return $this->_extension->getClientInfo();
if (! isset($this->_links[$link])) {
return '';
}
return $this->_extension->getClientInfo($this->_links[$link]);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Dbi/DbiDummy.php
Expand Up @@ -302,9 +302,11 @@ public function getProtoInfo($link)
/**
* returns a string that represents the client library version
*
* @param resource $link connection link
*
* @return string MySQL client library version
*/
public function getClientInfo()
public function getClientInfo($link)
{
return '';
}
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Dbi/DbiExtension.php
Expand Up @@ -155,9 +155,11 @@ public function getProtoInfo($link);
/**
* returns a string that represents the client library version
*
* @param resource $link mysql link
*
* @return string MySQL client library version
*/
public function getClientInfo();
public function getClientInfo($link);

/**
* returns last error message or false if no errors occurred
Expand Down
6 changes: 4 additions & 2 deletions libraries/classes/Dbi/DbiMysqli.php
Expand Up @@ -328,11 +328,13 @@ public function getProtoInfo($mysqli)
/**
* returns a string that represents the client library version
*
* @param \mysqli $mysqli mysql link
*
* @return string MySQL client library version
*/
public function getClientInfo()
public function getClientInfo($mysqli)
{
return mysqli_get_client_info();
return $mysqli->get_client_info();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Plugins/ImportPlugin.php
Expand Up @@ -43,9 +43,11 @@ public function __construct()
/**
* Handles the whole import logic
*
* @param array $sql_data 2-element array with sql data
*
* @return void
*/
abstract public function doImport();
abstract public function doImport(array &$sql_data = []);


/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon.dist
Expand Up @@ -7,16 +7,13 @@ parameters:
ignoreErrors:
- '#Function (get_login_credentials|uploadprogress_get_info) not found#'
- '#Instantiated class COM not found#'
- '#Method PhpMyAdmin\\Plugins\\ImportPlugin\:\:doImport\(\) invoked with 1 parameter, 0 required#'# Normal
- '#Call to method ([a-zA-Z\(\)]+) on an unknown class COM#'
- '#Table\\StructureController has an unused parameter#'
- '#NodeTrans::__construct\(\) does not call parent constructor#'
- '#Call to an undefined method PHPUnit\\Framework\\MockObject\\MockBuilder#'
- '#Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject#'
- '#Access to an undefined property PHPUnit\\Framework\\MockObject\\MockObject#'
- '#Access to an undefined property PhpMyAdmin\\TwoFactor\:\:\$(backend|showSubmit|available|writable)#'
- '#Call to an undefined method PhpMyAdmin\\Navigation\\Nodes\\Node\:\:getHiddenCount#'
- '#GisGeomTestCase::\$object#'
- '#Undefined variable: \$array#'
- '#Undefined variable: \$(cfg|db|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: \$(dir|error_header|error_message)#'#error.inc.php
Expand All @@ -33,7 +30,6 @@ parameters:
- '#Variable \$(routine|mode|title|message|output|nbResultsetToDisplay|item) might not be defined#'# Rte
- '#Variable \$time might not be defined#'#DatabaseInterface.php
- '#Variable \$contentPath in isset\(\) always exists and is not nullable#'#DatabaseInterface.php
- '#Function mysqli_get_client_info invoked with 0 parameters, 1 required#'#libraries/classes/Dbi/DbiMysqli.php
- '#Variable \$default_fk_check_value might not be defined#'#libraries/mult_submits.inc.php
- '#Variable \$http_response_header in isset\(\) always exists and is not nullable#'
- '#Variable \$(escape_class|escape_method|iconLinks|icons|where_clause|where_clause_html|condition_array|pos_next|pos_prev) might not be defined#'
Expand Down
1 change: 1 addition & 0 deletions test/classes/Gis/GisGeomTestCase.php
Expand Up @@ -18,6 +18,7 @@
*/
abstract class GisGeomTestCase extends TestCase
{
protected $object;

/**
* test generateParams method
Expand Down

0 comments on commit 525a436

Please sign in to comment.