Skip to content

Commit

Permalink
Improve some params and return types marked as mixed
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Dec 29, 2019
1 parent ba1e22c commit 51f292b
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions libraries/classes/Advisor.php
Expand Up @@ -126,9 +126,9 @@ function ($arguments, $value) {
/**
* Get variables
*
* @return mixed
* @return array
*/
public function getVariables()
public function getVariables(): array
{
return $this->variables;
}
Expand Down Expand Up @@ -165,9 +165,9 @@ public function setVariable($variable, $value): self
/**
* Get parseResult
*
* @return mixed
* @return array
*/
public function getParseResult()
public function getParseResult(): array
{
return $this->parseResult;
}
Expand All @@ -189,9 +189,9 @@ public function setParseResult(array $parseResult): self
/**
* Get runResult
*
* @return mixed
* @return array
*/
public function getRunResult()
public function getRunResult(): array
{
return $this->runResult;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Bookmark.php
Expand Up @@ -348,7 +348,7 @@ public static function getList(
* @param DatabaseInterface $dbi DatabaseInterface object
* @param string $user Current user
* @param string $db the current database name
* @param mixed $id an identifier of the bookmark to get
* @param int|string $id an identifier of the bookmark to get
* @param string $id_field which field to look up the identifier
* @param boolean $action_bookmark_all true: get all bookmarks regardless
* of the owning user
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Config.php
Expand Up @@ -1195,7 +1195,7 @@ public function checkErrors(): void
*
* @param string $setting config setting
*
* @return mixed value
* @return mixed|null value
*/
public function get(string $setting)
{
Expand Down Expand Up @@ -1517,7 +1517,7 @@ public function setCookie(
*
* @param string $cookieName The name of the cookie to get
*
* @return mixed result of getCookie()
* @return mixed|null result of getCookie()
*/
public function getCookie(string $cookieName)
{
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Core.php
Expand Up @@ -606,7 +606,7 @@ public static function downloadHeader(
* @param array $array the array
* @param mixed $default default value
*
* @return mixed array element or $default
* @return array|null|mixed array element or $default
*/
public static function arrayRead(string $path, array $array, $default = null)
{
Expand Down Expand Up @@ -1051,7 +1051,7 @@ public static function sanitizeMySQLUser(string $name): string
*
* @param string $data Data to unserialize
*
* @return mixed
* @return mixed|null
*/
public static function safeUnserialize(string $data)
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Database/DatabaseList.php
Expand Up @@ -48,7 +48,7 @@ public function __get($param)
*
* @return ListDatabase
*/
public function getDatabaseList()
public function getDatabaseList(): ListDatabase
{
if (null === $this->databases) {
$this->databases = new ListDatabase();
Expand Down
6 changes: 3 additions & 3 deletions libraries/classes/Display/Results.php
Expand Up @@ -240,7 +240,7 @@ public function __construct($db, $table, $server, $goto, $sql_query)
*
* @param string $property name of the property
*
* @return mixed|void if property exist, value of the relevant property
* @return mixed|null if property exist, value of the relevant property
*/
public function __get($property)
{
Expand Down Expand Up @@ -5655,14 +5655,14 @@ private function _getCheckboxAndLinks(
*
* @param string $str string to be truncated
*
* @return mixed
* @return array
*
* @access private
*
* @see _handleNonPrintableContents(), _getDataCellForGeometryColumns(),
* _getDataCellForNonNumericColumns
*/
private function _getPartialText($str)
private function _getPartialText($str): array
{
$original_length = mb_strlen($str);
if ($original_length > $GLOBALS['cfg']['LimitChars']
Expand Down
6 changes: 3 additions & 3 deletions libraries/classes/IndexColumn.php
Expand Up @@ -132,10 +132,10 @@ public function getCardinality()
*
* @param boolean $as_text whether to returned the string representation
*
* @return mixed nullability of the column. True/false or Yes/No depending
* on the value of the $as_text parameter
* @return string nullability of the column. True/false or Yes/No depending
* on the value of the $as_text parameter
*/
public function getNull($as_text = false)
public function getNull($as_text = false): string
{
if ($as_text) {
if (! $this->_null || $this->_null == 'NO') {
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/InsertEdit.php
Expand Up @@ -2898,9 +2898,9 @@ public function getTableColumns($db, $table)
* @param string $db current database
* @param string $table current table
*
* @return mixed
* @return array
*/
public function determineInsertOrEdit($where_clause, $db, $table)
public function determineInsertOrEdit($where_clause, $db, $table): array
{
if (isset($_POST['where_clause'])) {
$where_clause = $_POST['where_clause'];
Expand Down
6 changes: 3 additions & 3 deletions libraries/classes/ListAbstract.php
Expand Up @@ -57,9 +57,9 @@ public function exists(...$params)
/**
* returns HTML <option>-tags to be used inside <select></select>
*
* @param mixed $selected the selected db or true for
* selecting current db
* @param boolean $include_information_schema whether include information schema
* @param string|true $selected the selected db or true for
* selecting current db
* @param boolean $include_information_schema whether include information schema
*
* @return string HTML option tags
*/
Expand Down
12 changes: 6 additions & 6 deletions libraries/classes/Navigation/NavigationTree.php
Expand Up @@ -673,16 +673,16 @@ private function addDbContainers($db, $type, $pos2)
/**
* Recursively groups tree nodes given a separator
*
* @param mixed $node The node to group or null
* to group the whole tree. If
* passed as an argument, $node
* must be of type CONTAINER
* @param Node $node The node to group or null
* to group the whole tree. If
* passed as an argument, $node
* must be of type CONTAINER
*
* @return void
*/
public function groupTree($node = null)
public function groupTree(?Node $node = null): void
{
if (! isset($node)) {
if ($node === null) {
$node = $this->tree;
}
$this->groupNode($node);
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/NodeFactory.php
Expand Up @@ -78,14 +78,14 @@ private static function checkClass($class)
* @param bool $isGroup Whether this object has been created
* while grouping nodes
*
* @return mixed
* @return Node
*/
public static function getInstance(
$class = 'Node',
$name = 'default',
$type = Node::OBJECT,
$isGroup = false
) {
): Node {
$class = self::sanitizeClass($class);
return new $class($name, $type, $isGroup);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Replication.php
Expand Up @@ -70,7 +70,7 @@ public function extractDbOrTable($string, $what = 'db')
* SQL_THREAD and IO_THREAD
* @param integer $link mysql link
*
* @return mixed output of DatabaseInterface::tryQuery
* @return mixed|int output of DatabaseInterface::tryQuery
*/
public function slaveControl($action, $control = null, $link = null)
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Server/Privileges.php
Expand Up @@ -1681,7 +1681,7 @@ public function getUserGroupCount()
*
* @param string $username User name
*
* @return mixed usergroup if found or null if not found
* @return mixed|null usergroup if found or null if not found
*/
public function getUserGroupForUser($username)
{
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Sql.php
Expand Up @@ -318,11 +318,11 @@ private function getHtmlForProfilingChart($urlQuery, $database, $profilingResult
*
* @param array $profiling_results profiling results
*
* @return mixed
* @return array
*/
private function analyzeAndGetTableHtmlForProfilingResults(
$profiling_results
) {
): array {
$profiling_stats = [
'total_time' => 0,
'states' => [],
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Tracker.php
Expand Up @@ -665,13 +665,13 @@ public static function getTrackedData($dbname, $tablename, $version)
*
* @param string $query query
*
* @return mixed Array containing identifier, type and tablename.
* @return array containing identifier, type and tablename.
*
* @static
* @todo: using PMA SQL Parser when possible
* @todo: support multi-table/view drops
*/
public static function parseQuery($query)
public static function parseQuery($query): array
{
// Usage of PMA_SQP does not work here
//
Expand Down

0 comments on commit 51f292b

Please sign in to comment.