Fix some PHPStan level 3 errors

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-12-06 10:01:25 -03:00
parent 5f13152857
commit 4ea2bcdf4b
7 changed files with 48 additions and 50 deletions

View File

@ -33,8 +33,8 @@ interface DbiExtension
/**
* selects given database
*
* @param string $dbname database name to select
* @param resource $link connection object
* @param string $dbname database name to select
* @param object $link connection object
*
* @return boolean
*/
@ -43,9 +43,9 @@ interface DbiExtension
/**
* runs a query and returns the result
*
* @param string $query query to execute
* @param resource $link connection object
* @param int $options query options
* @param string $query query to execute
* @param object $link connection object
* @param int $options query options
*
* @return mixed result
*/
@ -54,8 +54,8 @@ interface DbiExtension
/**
* Run the multi query and output the results
*
* @param resource $link connection object
* @param string $query multi query statement to execute
* @param object $link connection object
* @param string $query multi query statement to execute
*
* @return array|bool
*/
@ -110,7 +110,7 @@ interface DbiExtension
/**
* Check if there are any more query results from a multi query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return bool true or false
*/
@ -119,7 +119,7 @@ interface DbiExtension
/**
* Prepare next result from multi_query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return bool true or false
*/
@ -128,7 +128,7 @@ interface DbiExtension
/**
* Store the result returned from multi query
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return mixed false when empty results / result set when not empty
*/
@ -137,7 +137,7 @@ interface DbiExtension
/**
* Returns a string representing the type of connection used
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return string type of connection used
*/
@ -146,16 +146,16 @@ interface DbiExtension
/**
* Returns the version of the MySQL protocol used
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return integer version of the MySQL protocol used
* @return int|string version of the MySQL protocol used
*/
public function getProtoInfo($link);
/**
* returns a string that represents the client library version
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return string MySQL client library version
*/
@ -164,7 +164,7 @@ interface DbiExtension
/**
* returns last error message or false if no errors occurred
*
* @param resource $link connection link
* @param object $link connection link
*
* @return string|bool error or false
*/
@ -182,7 +182,7 @@ interface DbiExtension
/**
* returns the number of rows affected by last query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return int
*/

View File

@ -139,7 +139,7 @@ class Pbxt extends StorageEngine
* returns the pbxt engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE variables.
*
* @param string $formatted_size the size expression (for example 8MB)
* @param int|string $formatted_size the size expression (for example 8MB)
*
* @return array the formatted value and its unit
*/

View File

@ -596,7 +596,7 @@ class ExportOdt extends ExportPlugin
* @param string $table table name
* @param array $aliases Aliases of db/table/columns
*
* @return bool true
* @return string
*/
protected function getTriggers($db, $table, array $aliases = [])
{
@ -651,7 +651,7 @@ class ExportOdt extends ExportPlugin
$GLOBALS['odt_buffer'] .= '</table:table>';
return true;
return $GLOBALS['odt_buffer'];
}
/**

View File

@ -1054,7 +1054,7 @@ class ExportSql extends ExportPlugin
$r &= $this->_exportMetadata($db, $tables, $metadataTypes);
}
return $r;
return (bool) $r;
}
/**
@ -2757,7 +2757,7 @@ class ExportSql extends ExportPlugin
) {
$statement->name->database = $new_database;
$statement->name->table = $new_table;
$statement->name->expr = null; // Force rebuild.
$statement->name->expr = ''; // Force rebuild.
$flag = true;
}
@ -2788,7 +2788,7 @@ class ExportSql extends ExportPlugin
if (! empty($aliases[$old_database]['tables'][$ref_table]['alias'])) {
$field->references->table->table
= $aliases[$old_database]['tables'][$ref_table]['alias'];
$field->references->table->expr = null;
$field->references->table->expr = '';
$flag = true;
}
// Replacing column names.
@ -2818,7 +2818,7 @@ class ExportSql extends ExportPlugin
if (! empty($aliases[$old_database]['tables'][$old_table]['alias'])) {
$statement->table->table
= $aliases[$old_database]['tables'][$old_table]['alias'];
$statement->table->expr = null; // Force rebuild.
$statement->table->expr = ''; // Force rebuild.
$flag = true;
}
}

View File

@ -38,7 +38,7 @@ abstract class PropertyItem
* the addProperty() or removeProperty() methods, which are not available
* for simple PhpMyAdmin\Properties\Options\OptionsPropertyOneItem subclasses.
*
* @return null
* @return null|object
*/
public function getGroup()
{

View File

@ -917,33 +917,31 @@ class ExportOdtTest extends PmaTestCase
$method->setAccessible(true);
$result = $method->invoke($this->object, 'database', 'ta<ble');
$this->assertTrue(
$this->assertSame($result, $GLOBALS['odt_buffer']);
$this->assertStringContainsString(
'<table:table table:name="ta&lt;ble_triggers">',
$result
);
$this->assertStringContainsString(
'<table:table table:name="ta&lt;ble_triggers">',
$GLOBALS['odt_buffer']
);
$this->assertStringContainsString(
'<text:p>tna&quot;me</text:p>',
$GLOBALS['odt_buffer']
$result
);
$this->assertStringContainsString(
'<text:p>ac&gt;t</text:p>',
$GLOBALS['odt_buffer']
$result
);
$this->assertStringContainsString(
'<text:p>manip&amp;</text:p>',
$GLOBALS['odt_buffer']
$result
);
$this->assertStringContainsString(
'<text:p>def</text:p>',
$GLOBALS['odt_buffer']
$result
);
}

View File

@ -65,8 +65,8 @@ class DbiDummy implements DbiExtension
/**
* selects given database
*
* @param string $dbname name of db to select
* @param resource $link mysql link resource
* @param string $dbname name of db to select
* @param object $link mysql link resource
*
* @return bool
*/
@ -80,9 +80,9 @@ class DbiDummy implements DbiExtension
/**
* runs a query and returns the result
*
* @param string $query query to run
* @param resource $link mysql link resource
* @param int $options query options
* @param string $query query to run
* @param object $link mysql link resource
* @param int $options query options
*
* @return mixed
*/
@ -121,8 +121,8 @@ class DbiDummy implements DbiExtension
/**
* Run the multi query and output the results
*
* @param resource $link connection object
* @param string $query multi query statement to execute
* @param object $link connection object
* @param string $query multi query statement to execute
*
* @return array|bool
*/
@ -243,7 +243,7 @@ class DbiDummy implements DbiExtension
/**
* Check if there are any more query results from a multi query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return bool false
*/
@ -255,7 +255,7 @@ class DbiDummy implements DbiExtension
/**
* Prepare next result from multi_query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return boolean false
*/
@ -267,7 +267,7 @@ class DbiDummy implements DbiExtension
/**
* Store the result returned from multi query
*
* @param resource $link the connection object
* @param object $link the connection object
*
* @return mixed false when empty results / result set when not empty
*/
@ -279,7 +279,7 @@ class DbiDummy implements DbiExtension
/**
* Returns a string representing the type of connection used
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return string type of connection used
*/
@ -291,7 +291,7 @@ class DbiDummy implements DbiExtension
/**
* Returns the version of the MySQL protocol used
*
* @param resource $link mysql link
* @param object $link mysql link
*
* @return integer version of the MySQL protocol used
*/
@ -303,7 +303,7 @@ class DbiDummy implements DbiExtension
/**
* returns a string that represents the client library version
*
* @param resource $link connection link
* @param object $link connection link
*
* @return string MySQL client library version
*/
@ -315,7 +315,7 @@ class DbiDummy implements DbiExtension
/**
* returns last error message or false if no errors occurred
*
* @param resource $link connection link
* @param object $link connection link
*
* @return string|bool error or false
*/
@ -345,8 +345,8 @@ class DbiDummy implements DbiExtension
/**
* returns the number of rows affected by last query
*
* @param resource $link the mysql object
* @param bool $get_from_cache whether to retrieve from cache
* @param object $link the mysql object
* @param bool $get_from_cache whether to retrieve from cache
*
* @return string|int
*/