diff options
author | MaurĂcio Meneghini Fauth <mauricio@fauth.dev> | 2021-09-15 14:31:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 14:31:56 +0300 |
commit | 70c43a98633dc475834a0a8d008d96e846dd2ec3 (patch) | |
tree | 675933537409ba0819e1083f9631bda06e4f5bc7 | |
parent | 03b9016b7d1b26114eb3c02649609e29fed1a51d (diff) | |
parent | 9f3510d11a2368d4a6f993b7e758c1aed3091ee1 (diff) |
Merge pull request #17110 from mauriciofauth/bool-return-type
Add `bool` return type where possible
100 files changed, 295 insertions, 991 deletions
diff --git a/libraries/classes/Bookmark.php b/libraries/classes/Bookmark.php index 14e2b17e3b..7e207cdae1 100644 --- a/libraries/classes/Bookmark.php +++ b/libraries/classes/Bookmark.php @@ -115,8 +115,6 @@ class Bookmark /** * Adds a bookmark * - * @return bool whether the INSERT succeeds or not - * * @access public */ public function save(): bool @@ -134,14 +132,12 @@ class Bookmark . "'" . $this->dbi->escapeString($this->query) . "', " . "'" . $this->dbi->escapeString($this->label) . "')"; - return $this->dbi->query($query, DatabaseInterface::CONNECT_CONTROL); + return (bool) $this->dbi->query($query, DatabaseInterface::CONNECT_CONTROL); } /** * Deletes a bookmark * - * @return bool true if successful - * * @access public */ public function delete(): bool @@ -155,7 +151,7 @@ class Bookmark . '.' . Util::backquote($cfgBookmark['table']) . ' WHERE id = ' . $this->id; - return $this->dbi->tryQuery($query, DatabaseInterface::CONNECT_CONTROL); + return (bool) $this->dbi->tryQuery($query, DatabaseInterface::CONNECT_CONTROL); } /** diff --git a/libraries/classes/Cache.php b/libraries/classes/Cache.php index 86229ec0d7..60a36f45d9 100644 --- a/libraries/classes/Cache.php +++ b/libraries/classes/Cache.php @@ -19,8 +19,6 @@ class Cache * * @param string $cacheKey The key to use * @param mixed $value The value to cache - * - * @return bool Depends on if the value could be cached */ public static function set(string $cacheKey, $value): bool { @@ -56,8 +54,6 @@ class Cache * Remove a cached value * * @param string $cacheKey The key to use to remove the value - * - * @return bool Depends on if the value could be removed */ public static function remove(string $cacheKey): bool { @@ -68,8 +64,6 @@ class Cache /** * Purge all cached values - * - * @return bool Depends on if the cache could be purged */ public static function purge(): bool { diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index b320073731..b5f85f4157 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -384,8 +384,6 @@ class Config /** * loads default values from default source - * - * @return bool success */ public function loadDefaults(): bool { @@ -727,8 +725,6 @@ class Config /** * check config source - * - * @return bool whether source is valid or not */ public function checkConfigSource(): bool { @@ -931,7 +927,7 @@ class Config public function isHttps(): bool { if ($this->get('is_https') !== null) { - return $this->get('is_https'); + return (bool) $this->get('is_https'); } $url = $this->get('PmaAbsoluteUri'); @@ -1019,8 +1015,6 @@ class Config * removes cookie * * @param string $cookieName name of cookie to remove - * - * @return bool result of setcookie() */ public function removeCookie(string $cookieName): bool { @@ -1053,8 +1047,6 @@ class Config * @param string $default default value * @param int $validity validity of cookie in seconds (default is one month) * @param bool $httponly whether cookie is only for HTTP (and not for scripts) - * - * @return bool result of setcookie() */ public function setCookie( string $cookie, @@ -1165,8 +1157,6 @@ class Config * isset cookie * * @param string $cookieName The name of the cookie to check - * - * @return bool result of issetCookie() */ public function issetCookie(string $cookieName): bool { diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index e00f687a6f..f45022ec48 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -160,10 +160,8 @@ class FormDisplay * @param bool $allowPartialSave allows for partial form saving * on failed validation * @param bool $checkFormSubmit whether check for $_POST['submit_save'] - * - * @return bool whether processing was successful */ - public function process($allowPartialSave = true, $checkFormSubmit = true) + public function process($allowPartialSave = true, $checkFormSubmit = true): bool { if ($checkFormSubmit && ! isset($_POST['submit_save'])) { return false; @@ -579,10 +577,8 @@ class FormDisplay * @param array|string $forms array of form names * @param bool $allowPartialSave allows for partial form saving on * failed validation - * - * @return bool true on success (no errors and all saved) */ - public function save($forms, $allowPartialSave = true) + public function save($forms, $allowPartialSave = true): bool { $result = true; $forms = (array) $forms; @@ -755,10 +751,8 @@ class FormDisplay /** * Tells whether form validation failed - * - * @return bool */ - public function hasErrors() + public function hasErrors(): bool { return count($this->errors) > 0; } diff --git a/libraries/classes/Config/Forms/BaseFormList.php b/libraries/classes/Config/Forms/BaseFormList.php index 131adef238..9ebd04f22b 100644 --- a/libraries/classes/Config/Forms/BaseFormList.php +++ b/libraries/classes/Config/Forms/BaseFormList.php @@ -38,10 +38,8 @@ class BaseFormList /** * @param string $name Name - * - * @return bool */ - public static function isValid($name) + public static function isValid($name): bool { return in_array($name, static::$all); } @@ -86,10 +84,8 @@ class BaseFormList * @param bool $allowPartialSave allows for partial form saving * on failed validation * @param bool $checkFormSubmit whether check for $_POST['submit_save'] - * - * @return bool whether processing was successful */ - public function process($allowPartialSave = true, $checkFormSubmit = true) + public function process($allowPartialSave = true, $checkFormSubmit = true): bool { $ret = true; foreach ($this->forms as $form) { @@ -126,10 +122,8 @@ class BaseFormList /** * Tells whether form validation failed - * - * @return bool */ - public function hasErrors() + public function hasErrors(): bool { $ret = false; foreach ($this->forms as $form) { diff --git a/libraries/classes/Config/ServerConfigChecks.php b/libraries/classes/Config/ServerConfigChecks.php index 416ae1a2a4..48b2e07229 100644 --- a/libraries/classes/Config/ServerConfigChecks.php +++ b/libraries/classes/Config/ServerConfigChecks.php @@ -557,10 +557,8 @@ class ServerConfigChecks * Wrapper around function_exists to allow mock in test * * @param string $name Function name - * - * @return bool */ - protected function functionExists($name) + protected function functionExists($name): bool { return function_exists($name); } diff --git a/libraries/classes/Controllers/Database/StructureController.php b/libraries/classes/Controllers/Database/StructureController.php index 8c9796c606..e5bf52392c 100644 --- a/libraries/classes/Controllers/Database/StructureController.php +++ b/libraries/classes/Controllers/Database/StructureController.php @@ -706,10 +706,8 @@ class StructureController extends AbstractController * * @param array $db DB to look into * @param string $truename Table name - * - * @return bool */ - protected function hasTable(array $db, $truename) + protected function hasTable(array $db, $truename): bool { foreach ($db as $dbTable) { if ( diff --git a/libraries/classes/Controllers/Table/Structure/SaveController.php b/libraries/classes/Controllers/Table/Structure/SaveController.php index eff57b74ff..c54314e299 100644 --- a/libraries/classes/Controllers/Table/Structure/SaveController.php +++ b/libraries/classes/Controllers/Table/Structure/SaveController.php @@ -80,7 +80,7 @@ final class SaveController extends AbstractController * * @return bool true if error occurred */ - private function updateColumns() + private function updateColumns(): bool { $err_url = Url::getFromRoute('/table/structure', [ 'db' => $this->db, @@ -348,10 +348,8 @@ final class SaveController extends AbstractController * Verifies if some elements of a column have changed * * @param int $i column index in the request - * - * @return bool true if we need to generate ALTER TABLE */ - private function columnNeedsAlterTable($i) + private function columnNeedsAlterTable($i): bool { // these two fields are checkboxes so might not be part of the // request; therefore we define them to avoid notices below @@ -393,11 +391,8 @@ final class SaveController extends AbstractController * * @param array $adjust_privileges assoc array of old col names mapped to new * cols - * - * @return bool boolean whether at least one column privileges - * adjusted */ - private function adjustColumnPrivileges(array $adjust_privileges) + private function adjustColumnPrivileges(array $adjust_privileges): bool { $changed = false; diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index e0cfbf3c37..d407ef49a4 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -293,8 +293,6 @@ class Core * @param string $page page to check * @param array $allowList allow list to check page against * @param bool $include whether the page is going to be included - * - * @return bool whether $page is valid or not (in $allowList or not) */ public static function checkPageValidity(&$page, array $allowList = [], $include = false): bool { @@ -661,9 +659,6 @@ class Core * Use only for URLs of external sites. * * @param string $url URL of external site. - * - * @return bool True: if domain of $url is allowed domain, - * False: otherwise. */ public static function isAllowedDomain(string $url): bool { @@ -763,8 +758,6 @@ class Core * recursively check if variable is empty * * @param mixed $value the variable - * - * @return bool true if empty */ public static function emptyRecursive($value): bool { @@ -997,10 +990,8 @@ class Core * * @param string $sqlQuery The sql query * @param string $signature The Signature to check - * - * @return bool */ - public static function checkSqlQuerySignature($sqlQuery, $signature) + public static function checkSqlQuerySignature($sqlQuery, $signature): bool { global $cfg; diff --git a/libraries/classes/Database/Designer/Common.php b/libraries/classes/Database/Designer/Common.php index c1b0bb99d3..6631c51c8a 100644 --- a/libraries/classes/Database/Designer/Common.php +++ b/libraries/classes/Database/Designer/Common.php @@ -331,10 +331,8 @@ class Common * Deletes a given pdf page and its corresponding coordinates * * @param int $pg page id - * - * @return bool success/failure */ - public function deletePage($pg) + public function deletePage($pg): bool { $cfgRelation = $this->relation->getRelationsParam(); if (! $cfgRelation['pdfwork']) { @@ -405,8 +403,6 @@ class Common * If no such exists, returns negative index. * * @param string $pg name - * - * @return bool if the page already exists */ public function getPageExists(string $pg): bool { @@ -495,10 +491,8 @@ class Common * Saves positions of table(s) of a given pdf page * * @param int $pg pdf page id - * - * @return bool success/failure */ - public function saveTablePositions($pg) + public function saveTablePositions($pg): bool { $pageId = $this->dbi->escapeString((string) $pg); @@ -834,10 +828,8 @@ class Common * * @param string $index setting * @param string $value value - * - * @return bool whether the operation succeeded */ - public function saveSetting($index, $value) + public function saveSetting($index, $value): bool { $cfgRelation = $this->relation->getRelationsParam(); $success = true; diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index a030afe09e..91fb054221 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -1045,8 +1045,6 @@ class DatabaseInterface implements DbalInterface * @param string $var variable name * @param string $value value to set * @param mixed $link mysql link resource|object - * - * @return bool whether query was a successful */ public function setVariable( string $var, @@ -1062,7 +1060,7 @@ class DatabaseInterface implements DbalInterface return true; } - return $this->query('SET ' . $var . ' = ' . $value . ';', $link); + return (bool) $this->query('SET ' . $var . ' = ' . $value . ';', $link); } /** @@ -1791,7 +1789,7 @@ class DatabaseInterface implements DbalInterface public function isSuperUser(): bool { if (SessionCache::has('is_superuser')) { - return SessionCache::get('is_superuser'); + return (bool) SessionCache::get('is_superuser'); } if (! $this->isConnected()) { @@ -1820,7 +1818,7 @@ class DatabaseInterface implements DbalInterface global $cfg; if (SessionCache::has('is_grantuser')) { - return SessionCache::get('is_grantuser'); + return (bool) SessionCache::get('is_grantuser'); } if (! $this->isConnected()) { @@ -1863,7 +1861,7 @@ class DatabaseInterface implements DbalInterface global $cfg; if (SessionCache::has('is_createuser')) { - return SessionCache::get('is_createuser'); + return (bool) SessionCache::get('is_createuser'); } if (! $this->isConnected()) { @@ -2068,8 +2066,6 @@ class DatabaseInterface implements DbalInterface * * @param object $result database result * @param int $offset offset to seek - * - * @return bool true on success, false on failure */ public function dataSeek($result, int $offset): bool { @@ -2090,8 +2086,6 @@ class DatabaseInterface implements DbalInterface * Check if there are any more query results from a multi query * * @param int $link link type - * - * @return bool true or false */ public function moreResults($link = self::CONNECT_USER): bool { @@ -2106,8 +2100,6 @@ class DatabaseInterface implements DbalInterface * Prepare next result from multi_query * * @param int $link link type - * - * @return bool true or false */ public function nextResult($link = self::CONNECT_USER): bool { diff --git a/libraries/classes/Dbal/DbalInterface.php b/libraries/classes/Dbal/DbalInterface.php index 9ba255acf7..c426e45ad0 100644 --- a/libraries/classes/Dbal/DbalInterface.php +++ b/libraries/classes/Dbal/DbalInterface.php @@ -245,8 +245,6 @@ interface DbalInterface * @param string $var variable name * @param string $value value to set * @param mixed $link mysql link resource|object - * - * @return bool whether query was a successful */ public function setVariable(string $var, string $value, $link = DatabaseInterface::CONNECT_USER): bool; @@ -476,8 +474,6 @@ interface DbalInterface /** * Checks if current user is superuser - * - * @return bool Whether user is a superuser */ public function isSuperUser(): bool; @@ -547,8 +543,6 @@ interface DbalInterface * * @param object $result database result * @param int $offset offset to seek - * - * @return bool true on success, false on failure */ public function dataSeek($result, int $offset): bool; @@ -563,8 +557,6 @@ interface DbalInterface * Check if there are any more query results from a multi query * * @param int $link link type - * - * @return bool true or false */ public function moreResults($link = DatabaseInterface::CONNECT_USER): bool; @@ -572,8 +564,6 @@ interface DbalInterface * Prepare next result from multi_query * * @param int $link link type - * - * @return bool true or false */ public function nextResult($link = DatabaseInterface::CONNECT_USER): bool; diff --git a/libraries/classes/Dbal/DbiExtension.php b/libraries/classes/Dbal/DbiExtension.php index 9ed06fccbf..909c5f40a1 100644 --- a/libraries/classes/Dbal/DbiExtension.php +++ b/libraries/classes/Dbal/DbiExtension.php @@ -34,10 +34,8 @@ interface DbiExtension * * @param string|DatabaseName $databaseName database name to select * @param object $link connection object - * - * @return bool */ - public function selectDb($databaseName, $link); + public function selectDb($databaseName, $link): bool; /** * runs a query and returns the result @@ -86,10 +84,8 @@ interface DbiExtension * * @param object $result database result * @param int $offset offset to seek - * - * @return bool true on success, false on failure */ - public function dataSeek($result, $offset); + public function dataSeek($result, $offset): bool; /** * Frees memory associated with the result @@ -102,19 +98,15 @@ interface DbiExtension * Check if there are any more query results from a multi query * * @param object $link the connection object - * - * @return bool true or false */ - public function moreResults($link); + public function moreResults($link): bool; /** * Prepare next result from multi_query * * @param object $link the connection object - * - * @return bool true or false */ - public function nextResult($link); + public function nextResult($link): bool; /** * Store the result returned from multi query diff --git a/libraries/classes/Dbal/DbiMysqli.php b/libraries/classes/Dbal/DbiMysqli.php index 6308df2122..1ce43e7d3c 100644 --- a/libraries/classes/Dbal/DbiMysqli.php +++ b/libraries/classes/Dbal/DbiMysqli.php @@ -168,10 +168,8 @@ class DbiMysqli implements DbiExtension * * @param string|DatabaseName $databaseName database name to select * @param mysqli $link the mysqli object - * - * @return bool */ - public function selectDb($databaseName, $link) + public function selectDb($databaseName, $link): bool { return $link->select_db((string) $databaseName); } @@ -203,10 +201,8 @@ class DbiMysqli implements DbiExtension * * @param mysqli $link mysqli object * @param string $query multi query statement to execute - * - * @return bool */ - public function realMultiQuery($link, $query) + public function realMultiQuery($link, $query): bool { return $link->multi_query($query); } @@ -258,10 +254,8 @@ class DbiMysqli implements DbiExtension * * @param mysqli_result $result database result * @param int $offset offset to seek - * - * @return bool true on success, false on failure */ - public function dataSeek($result, $offset) + public function dataSeek($result, $offset): bool { return $result->data_seek($offset); } @@ -284,10 +278,8 @@ class DbiMysqli implements DbiExtension * Check if there are any more query results from a multi query * * @param mysqli $link the mysqli object - * - * @return bool true or false */ - public function moreResults($link) + public function moreResults($link): bool { return $link->more_results(); } @@ -296,10 +288,8 @@ class DbiMysqli implements DbiExtension * Prepare next result from multi_query * * @param mysqli $link the mysqli object - * - * @return bool true or false */ - public function nextResult($link) + public function nextResult($link): bool { return $link->next_result(); } diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index b545ca306c..4501724d78 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -695,11 +695,9 @@ class Results * * @param array $analyzedSqlResults analyzed sql results * - * @return bool - * * @access private */ - private function isSelect(array $analyzedSqlResults) + private function isSelect(array $analyzedSqlResults): bool { return ! ($this->properties['is_count'] || $this->properties['is_export'] @@ -1880,8 +1878,6 @@ class Results * @param string $sortTable the table name * @param string $nameToUseInSort the sorting column name * - * @return bool the column sorted or not - * * @access private */ private function isInSorted( @@ -1889,7 +1885,7 @@ class Results array $sortExpressionNoDirection, $sortTable, $nameToUseInSort - ) { + ): bool { $indexInExpression = 0; foreach ($sortExpressionNoDirection as $index => $clause) { diff --git a/libraries/classes/Engines/Innodb.php b/libraries/classes/Engines/Innodb.php index dbfbcdf69e..8e141e278f 100644 --- a/libraries/classes/Engines/Innodb.php +++ b/libraries/classes/Engines/Innodb.php @@ -364,10 +364,8 @@ class Innodb extends StorageEngine * Verifies if this server supports the innodb_file_per_table feature * * (do not confuse this with phpMyAdmin's storage engine plugins!) - * - * @return bool whether this feature is supported or not */ - public function supportsFilePerTable() + public function supportsFilePerTable(): bool { global $dbi; diff --git a/libraries/classes/ErrorHandler.php b/libraries/classes/ErrorHandler.php index 4dcd8f9bf5..787fdc4466 100644 --- a/libraries/classes/ErrorHandler.php +++ b/libraries/classes/ErrorHandler.php @@ -552,8 +552,6 @@ class ErrorHandler * also collected by global error handler. * This distinguishes between the actual errors * and user errors raised to warn user. - * - * @return bool true if there are errors to be "prompted", false otherwise */ public function hasErrorsForPrompt(): bool { diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index a6bc7811ec..31196515e0 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -101,8 +101,6 @@ class Export /** * Detect whether gzencode is needed; it might not be needed if * the server is already compressing by itself - * - * @return bool Whether gzencode is needed */ public function gzencodeNeeded(): bool { @@ -128,8 +126,6 @@ class Export * $this->dumpBuffer, otherwise it prints them out. * * @param string $line the insert statement - * - * @return bool Whether output succeeded */ public function outputHandler(?string $line): bool { diff --git a/libraries/classes/Export/Options.php b/libraries/classes/Export/Options.php index 789e71af7c..2a103dfbbf 100644 --- a/libraries/classes/Export/Options.php +++ b/libraries/classes/Export/Options.php @@ -40,10 +40,8 @@ final class Options * Outputs appropriate checked statement for checkbox. * * @param string $str option name - * - * @return bool */ - private function checkboxCheck($str) + private function checkboxCheck($str): bool { return isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]; diff --git a/libraries/classes/File.php b/libraries/classes/File.php index 58f94144ec..2ce7b58802 100644 --- a/libraries/classes/File.php +++ b/libraries/classes/File.php @@ -132,8 +132,6 @@ class File /** * deletes file if it is temporary, usually from a moved upload file * - * @return bool success - * * @access public */ public function cleanUp(): bool @@ -148,8 +146,6 @@ class File /** * deletes the file * - * @return bool success - * * @access public */ public function delete(): bool @@ -163,8 +159,6 @@ class File * * @param bool $is_temp sets the temp flag * - * @return bool File::$_is_temp - * * @access public */ public function isTemp(?bool $is_temp = null): bool @@ -263,8 +257,6 @@ class File * * @param string $name name of file uploaded * - * @return bool success - * * @access public */ public function setUploadedFile(string $name): bool @@ -287,8 +279,6 @@ class File * @param string $key the md5 hash of the column name * @param string $rownumber number of row to process * - * @return bool success - * * @access public */ public function setUploadedFromTblChangeRequest( @@ -395,8 +385,6 @@ class File * @param string $key the md5 hash of the column name * @param string $rownumber number of row to process * - * @return bool success - * * @access public */ public function setSelectedFromTblChangeRequest( @@ -431,8 +419,6 @@ class File /** * Checks whether there was any error. * - * @return bool whether an error occurred or not - * * @access public */ public function isError(): bool @@ -447,8 +433,6 @@ class File * @param string $key the md5 hash of the column name * @param string $rownumber number of row to process * - * @return bool success - * * @access public */ public function checkTblChangeForm(string $key, string $rownumber): bool @@ -477,8 +461,6 @@ class File * * @param string $name file name * - * @return bool success - * * @access public */ public function setLocalSelectedFile(string $name): bool @@ -514,8 +496,6 @@ class File /** * Checks whether file can be read. * - * @return bool whether the file is readable or not - * * @access public */ public function isReadable(): bool @@ -530,8 +510,6 @@ class File * before opening it. The FAQ 1.11 explains how to create the "./tmp" * directory - if needed * - * @return bool whether uploaded file is fine or not - * * @todo move check of $cfg['TempDir'] into Config? * @access public */ diff --git a/libraries/classes/Gis/GisPolygon.php b/libraries/classes/Gis/GisPolygon.php index 46f134f301..a9f856bf34 100644 --- a/libraries/classes/Gis/GisPolygon.php +++ b/libraries/classes/Gis/GisPolygon.php @@ -425,12 +425,10 @@ class GisPolygon extends GisGeometry * * @param array $ring array of points forming the ring * - * @return bool whether a set of points represents an outer ring - * * @access public * @static */ - public static function isOuterRing(array $ring) + public static function isOuterRing(array $ring): bool { // If area is negative then it's in clockwise orientation, // i.e. it's an outer ring @@ -443,12 +441,10 @@ class GisPolygon extends GisGeometry * @param array $point x, y coordinates of the point * @param array $polygon array of points forming the ring * - * @return bool whether a given point is inside a given polygon - * * @access public * @static */ - public static function isPointInsidePolygon(array $point, array $polygon) + public static function isPointInsidePolygon(array $point, array $polygon): bool { // If first point is repeated at the end remove it $last = count($polygon) - 1; diff --git a/libraries/classes/Gis/GisVisualization.php b/libraries/classes/Gis/GisVisualization.php index 43c3ad76cb..c61edf000f 100644 --- a/libraries/classes/Gis/GisVisualization.php +++ b/libraries/classes/Gis/GisVisualization.php @@ -138,10 +138,8 @@ class GisVisualization /** * Check if data has SRID - * - * @return bool */ - public function hasSrid() + public function hasSrid(): bool { foreach ($this->data as $row) { if ($row['srid'] != 0) { diff --git a/libraries/classes/Git.php b/libraries/classes/Git.php index 2601082fcb..e4540d3cdd 100644 --- a/libraries/classes/Git.php +++ b/libraries/classes/Git.php @@ -92,7 +92,7 @@ class Git // Define location using cached value $git_location = $_SESSION['git_location']; - return $_SESSION['is_git_revision']; + return (bool) $_SESSION['is_git_revision']; } // find out if there is a .git folder diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index 07e27a5816..85efd517de 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -81,8 +81,6 @@ class Import /** * Checks whether timeout is getting close * - * @return bool true if timeout is close - * * @access public */ public function checkTimeout(): bool diff --git a/libraries/classes/Import/Ajax.php b/libraries/classes/Import/Ajax.php index 61b808cbec..94383cc735 100644 --- a/libraries/classes/Import/Ajax.php +++ b/libraries/classes/Import/Ajax.php @@ -70,9 +70,6 @@ final class Ajax /** * Checks if PhpMyAdmin\Plugins\Import\Upload\UploadProgress bar extension is * available. - * - * @return bool true if PhpMyAdmin\Plugins\Import\Upload\UploadProgress - * extension is available, false if it is not */ public static function progressCheck(): bool { @@ -81,9 +78,6 @@ final class Ajax /** * Checks if PHP 5.4 session upload-progress feature is available. - * - * @return bool true if PHP 5.4 session upload-progress is available, - * false if it is not */ public static function sessionCheck(): bool { diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index 2841cd3cf4..13efbb70b7 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -227,10 +227,8 @@ class Index * * @param string $table table * @param string $schema schema - * - * @return bool whether loading was successful */ - private static function loadIndexes($table, $schema) + private static function loadIndexes($table, $schema): bool { global $dbi; @@ -312,10 +310,8 @@ class Index * Returns true if $column indexed in this index * * @param string $column the column - * - * @return bool true if $column indexed in this index */ - public function hasColumn($column) + public function hasColumn($column): bool { return isset($this->columns[$column]); } diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 72934ff195..68a40b44c0 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -205,8 +205,6 @@ class InsertEdit * @param array $whereClauseArray array of where clauses * @param string $localQuery query performed * @param array $result MySQL result handle - * - * @return bool */ private function showEmptyResultMessageOrSetUniqueCondition( array $rows, @@ -214,7 +212,7 @@ class InsertEdit array $whereClauseArray, $localQuery, array $result - ) { + ): bool { $hasUniqueCondition = false; // No row returned @@ -439,10 +437,8 @@ class InsertEdit * * @param array $column description of column in given table * @param array $types the types to verify - * - * @return bool whether the column's type if one of the $types */ - public function isColumn(array $column, array $types) + public function isColumn(array $column, array $types): bool { foreach ($types as $oneType) { if (mb_stripos($column['Type'], $oneType) === 0) { diff --git a/libraries/classes/IpAllowDeny.php b/libraries/classes/IpAllowDeny.php index 9c64befb47..0ec09306e3 100644 --- a/libraries/classes/IpAllowDeny.php +++ b/libraries/classes/IpAllowDeny.php @@ -36,11 +36,9 @@ class IpAllowDeny * @param string $testRange string of IP range to match * @param string $ipToTest string of IP to test against range * - * @return bool whether the IP mask matches - * * @access public */ - public function ipMaskTest($testRange, $ipToTest) + public function ipMaskTest($testRange, $ipToTest): bool { if ( mb_strpos($testRange, ':') > -1 @@ -72,11 +70,9 @@ class IpAllowDeny * @param string $testRange string of IP range to match * @param string $ipToTest string of IP to test against range * - * @return bool whether the IP mask matches - * * @access public */ - public function ipv4MaskTest($testRange, $ipToTest) + public function ipv4MaskTest($testRange, $ipToTest): bool { $result = true; $match = preg_match( @@ -144,11 +140,9 @@ class IpAllowDeny * @param string $test_range string of IP range to match * @param string $ip_to_test string of IP to test against range * - * @return bool whether the IP mask matches - * * @access public */ - public function ipv6MaskTest($test_range, $ip_to_test) + public function ipv6MaskTest($test_range, $ip_to_test): bool { $result = true; @@ -240,11 +234,9 @@ class IpAllowDeny * * @see Core::getIp() * - * @return bool Whether rule has matched - * * @access public */ - public function allow() + public function allow(): bool { return $this->allowDeny('allow'); } @@ -254,11 +246,9 @@ class IpAllowDeny * * @see Core::getIp() * - * @return bool Whether rule has matched - * * @access public */ - public function deny() + public function deny(): bool { return $this->allowDeny('deny'); } @@ -270,11 +260,9 @@ class IpAllowDeny * * @param string $type 'allow' | 'deny' type of rule to match * - * @return bool Whether rule has matched - * * @access public */ - private function allowDeny($type) + private function allowDeny($type): bool { global $cfg; diff --git a/libraries/classes/Language.php b/libraries/classes/Language.php index cc5e3403a5..49cd698b19 100644 --- a/libraries/classes/Language.php +++ b/libraries/classes/Language.php @@ -127,10 +127,8 @@ class Language /** * Checks whether language is currently active. - * - * @return bool */ - public function isActive() + public function isActive(): bool { return $GLOBALS['lang'] == $this->code; } @@ -139,40 +137,34 @@ class Language * Checks whether language matches HTTP header Accept-Language. * * @param string $header Header content - * - * @return bool */ - public function matchesAcceptLanguage($header) + public function matchesAcceptLanguage($header): bool { $pattern = '/^(' . addcslashes($this->regex, '/') . ')(;q=[0-9]\\.[0-9])?$/i'; - return preg_match($pattern, $header); + return (bool) preg_match($pattern, $header); } /** * Checks whether language matches HTTP header User-Agent * * @param string $header Header content - * - * @return bool */ - public function matchesUserAgent($header) + public function matchesUserAgent($header): bool { $pattern = '/(\(|\[|;[[:space:]])(' . addcslashes($this->regex, '/') . ')(;|\]|\))/i'; - return preg_match($pattern, $header); + return (bool) preg_match($pattern, $header); } /** * Checks whether language is RTL - * - * @return bool */ - public function isRTL() + public function isRTL(): bool { return in_array($this->code, ['ar', 'fa', 'he', 'ur']); } diff --git a/libraries/classes/LanguageManager.php b/libraries/classes/LanguageManager.php index e03fdb75a7..c5445dd17a 100644 --- a/libraries/classes/LanguageManager.php +++ b/libraries/classes/LanguageManager.php @@ -798,10 +798,8 @@ class LanguageManager /** * Checks whether there are some languages available - * - * @return bool */ - public function hasChoice() + public function hasChoice(): bool { return count($this->availableLanguages()) > 1; } diff --git a/libraries/classes/ListAbstract.php b/libraries/classes/ListAbstract.php index 63e101f9d5..d8c8fe3dbc 100644 --- a/libraries/classes/ListAbstract.php +++ b/libraries/classes/ListAbstract.php @@ -32,10 +32,8 @@ abstract class ListAbstract extends ArrayObject * missing at least one item it returns false otherwise true * * @param mixed[] ...$params params - * - * @return bool true if all items exists, otherwise false */ - public function exists(...$params) + public function exists(...$params): bool { $this_elements = $this->getArrayCopy(); foreach ($params as $result) { diff --git a/libraries/classes/ListDatabase.php b/libraries/classes/ListDatabase.php index aa8c12b817..ede03e00ce 100644 --- a/libraries/classes/ListDatabase.php +++ b/libraries/classes/ListDatabase.php @@ -121,10 +121,8 @@ class ListDatabase extends ListAbstract /** * checks the only_db configuration - * - * @return bool false if there is no only_db, otherwise true */ - protected function checkOnlyDatabase() + protected function checkOnlyDatabase(): bool { if ( is_string($GLOBALS['cfg']['Server']['only_db']) diff --git a/libraries/classes/Message.php b/libraries/classes/Message.php index 650a3df677..6b9a51ed3e 100644 --- a/libraries/classes/Message.php +++ b/libraries/classes/Message.php @@ -359,8 +359,6 @@ class Message implements Stringable * and optionally makes this message a success message * * @param bool $set Whether to make this message of SUCCESS type - * - * @return bool whether this is a success message or not */ public function isSuccess(bool $set = false): bool { @@ -376,8 +374,6 @@ class Message implements Stringable * and optionally makes this message a notice message * * @param bool $set Whether to make this message of NOTICE type - * - * @return bool whether this is a notice message or not */ public function isNotice(bool $set = false): bool { @@ -393,8 +389,6 @@ class Message implements Stringable * and optionally makes this message an error message * * @param bool $set Whether to make this message of ERROR type - * - * @return bool Whether this is an error message or not */ public function isError(bool $set = false): bool { @@ -776,8 +770,6 @@ class Message implements Stringable * sets and returns whether the message was displayed or not * * @param bool $isDisplayed whether to set displayed flag - * - * @return bool Message::$isDisplayed */ public function isDisplayed(bool $isDisplayed = false): bool { diff --git a/libraries/classes/Navigation/Nodes/Node.php b/libraries/classes/Navigation/Nodes/Node.php index 1a25adc89c..02a85b6a7d 100644 --- a/libraries/classes/Navigation/Nodes/Node.php +++ b/libraries/classes/Navigation/Nodes/Node.php @@ -265,8 +265,6 @@ class Node * * @param bool $countEmptyContainers Whether to count empty child * containers as valid children - * - * @return bool Whether the node has child nodes */ public function hasChildren($countEmptyContainers = true): bool { @@ -508,10 +506,8 @@ class Node * Detemines whether a given database should be hidden according to 'hide_db' * * @param string $db database name - * - * @return bool whether to hide */ - private function isHideDb($db) + private function isHideDb($db): bool { return ! empty($GLOBALS['cfg']['Server']['hide_db']) && preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db); diff --git a/libraries/classes/Normalization.php b/libraries/classes/Normalization.php index 04b583639d..4be9daad0d 100644 --- a/libraries/classes/Normalization.php +++ b/libraries/classes/Normalization.php @@ -1103,8 +1103,6 @@ class Normalization * @param int $pkCnt distinct value count for given partial key * @param int $colCnt distinct value count for given column * @param int $totalRows total distinct rows count of the table - * - * @return bool TRUE if $column is dependent on $partialKey, False otherwise */ private function checkPartialDependency( $partialKey, @@ -1113,7 +1111,7 @@ class Normalization $pkCnt, $colCnt, $totalRows - ) { + ): bool { $query = 'SELECT ' . 'COUNT(DISTINCT ' . $partialKey . ',' . $column . ') as pkColCnt ' . 'FROM (SELECT * FROM ' . Util::backquote($table) diff --git a/libraries/classes/Partitioning/Partition.php b/libraries/classes/Partitioning/Partition.php index e43a97c0e9..f034383fb5 100644 --- a/libraries/classes/Partitioning/Partition.php +++ b/libraries/classes/Partitioning/Partition.php @@ -61,10 +61,8 @@ class Partition extends SubPartition /** * Whether there are sub partitions - * - * @return bool */ - public function hasSubPartitions() + public function hasSubPartitions(): bool { return ! empty($this->subPartitions); } @@ -240,14 +238,12 @@ class Partition extends SubPartition /** * checks if MySQL server supports partitioning * - * @return bool - * * @static * @staticvar bool $have_partitioning * @staticvar bool $already_checked * @access public */ - public static function havePartitioning() + public static function havePartitioning(): bool { global $dbi; diff --git a/libraries/classes/Plugins/Auth/AuthenticationConfig.php b/libraries/classes/Plugins/Auth/AuthenticationConfig.php index e0d1c3897a..6f64678688 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationConfig.php +++ b/libraries/classes/Plugins/Auth/AuthenticationConfig.php @@ -32,7 +32,7 @@ class AuthenticationConfig extends AuthenticationPlugin * * @return bool always true */ - public function showLoginForm() + public function showLoginForm(): bool { $response = ResponseRenderer::getInstance(); if ($response->isAjax()) { @@ -54,7 +54,7 @@ class AuthenticationConfig extends AuthenticationPlugin * * @return bool always true */ - public function readCredentials() + public function readCredentials(): bool { if ($GLOBALS['token_provided'] && $GLOBALS['token_mismatch']) { return false; diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index 8b25502e23..237466cb32 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -90,11 +90,9 @@ class AuthenticationCookie extends AuthenticationPlugin * * this function MUST exit/quit the application * - * @return bool|void - * * @global string $conn_error the last connection error */ - public function showLoginForm() + public function showLoginForm(): bool { global $conn_error, $route; @@ -269,10 +267,8 @@ class AuthenticationCookie extends AuthenticationPlugin * it returns true if all seems ok which usually leads to auth_set_user() * * it directly switches to showFailure() if user inactivity timeout is reached - * - * @return bool whether we get authentication settings or not */ - public function readCredentials() + public function readCredentials(): bool { global $conn_error; @@ -477,7 +473,7 @@ class AuthenticationCookie extends AuthenticationPlugin * * @return bool always true */ - public function storeCredentials() + public function storeCredentials(): bool { global $cfg; @@ -510,10 +506,8 @@ class AuthenticationCookie extends AuthenticationPlugin /** * Stores user credentials after successful login. - * - * @return void|bool */ - public function rememberCredentials() + public function rememberCredentials(): void { global $route; @@ -562,33 +556,30 @@ class AuthenticationCookie extends AuthenticationPlugin exit; } - return false; + return; } // Set server cookies if required (once per session) and, in this case, // force reload to ensure the client accepts cookies - if (! $GLOBALS['from_cookie']) { + if ($GLOBALS['from_cookie']) { + return; + } - /** - * Clear user cache. - */ - Util::clearUserCache(); + /** + * Clear user cache. + */ + Util::clearUserCache(); - ResponseRenderer::getInstance() - ->disable(); + ResponseRenderer::getInstance()->disable(); - Core::sendHeaderLocation( - './index.php?route=/' . Url::getCommonRaw($url_params, '&'), - true - ); - if (! defined('TESTSUITE')) { - exit; - } + Core::sendHeaderLocation( + './index.php?route=/' . Url::getCommonRaw($url_params, '&'), + true + ); - return false; + if (! defined('TESTSUITE')) { + exit; } - - return true; } /** diff --git a/libraries/classes/Plugins/Auth/AuthenticationHttp.php b/libraries/classes/Plugins/Auth/AuthenticationHttp.php index 5e1e74ca5e..201ca65a76 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationHttp.php +++ b/libraries/classes/Plugins/Auth/AuthenticationHttp.php @@ -34,7 +34,7 @@ class AuthenticationHttp extends AuthenticationPlugin * * @return bool always true (no return indeed) */ - public function showLoginForm() + public function showLoginForm(): bool { $response = ResponseRenderer::getInstance(); if ($response->isAjax()) { @@ -53,10 +53,8 @@ class AuthenticationHttp extends AuthenticationPlugin /** * Displays authentication form - * - * @return bool */ - public function authForm() + public function authForm(): bool { if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) { if (empty($GLOBALS['cfg']['Server']['verbose'])) { @@ -107,10 +105,8 @@ class AuthenticationHttp extends AuthenticationPlugin /** * Gets authentication credentials - * - * @return bool whether we get authentication settings or not */ - public function readCredentials() + public function readCredentials(): bool { // Grabs the $PHP_AUTH_USER variable if (isset($GLOBALS['PHP_AUTH_USER'])) { diff --git a/libraries/classes/Plugins/Auth/AuthenticationSignon.php b/libraries/classes/Plugins/Auth/AuthenticationSignon.php index d8f3e6a00e..26a911af1d 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationSignon.php +++ b/libraries/classes/Plugins/Auth/AuthenticationSignon.php @@ -37,7 +37,7 @@ class AuthenticationSignon extends AuthenticationPlugin * * @return bool always true (no return indeed) */ - public function showLoginForm() + public function showLoginForm(): bool { ResponseRenderer::getInstance()->disable(); unset($_SESSION['LAST_SIGNON_URL']); @@ -118,10 +118,8 @@ class AuthenticationSignon extends AuthenticationPlugin /** * Gets authentication credentials - * - * @return bool whether we get authentication settings or not */ - public function readCredentials() + public function readCredentials(): bool { /* Check if we're using same signon server */ $signon_url = $GLOBALS['cfg']['Server']['SignonURL']; diff --git a/libraries/classes/Plugins/AuthenticationPlugin.php b/libraries/classes/Plugins/AuthenticationPlugin.php index 7e216a2126..04426da221 100644 --- a/libraries/classes/Plugins/AuthenticationPlugin.php +++ b/libraries/classes/Plugins/AuthenticationPlugin.php @@ -63,24 +63,18 @@ abstract class AuthenticationPlugin /** * Displays authentication form - * - * @return bool */ - abstract public function showLoginForm(); + abstract public function showLoginForm(): bool; /** * Gets authentication credentials - * - * @return bool */ - abstract public function readCredentials(); + abstract public function readCredentials(): bool; /** * Set the user and password after last checkings if required - * - * @return bool */ - public function storeCredentials() + public function storeCredentials(): bool { global $cfg; @@ -94,10 +88,8 @@ abstract class AuthenticationPlugin /** * Stores user credentials after successful login. - * - * @return void */ - public function rememberCredentials() + public function rememberCredentials(): void { } diff --git a/libraries/classes/Plugins/Export/ExportCodegen.php b/libraries/classes/Plugins/Export/ExportCodegen.php index 3c5cf1e868..37ff26bd67 100644 --- a/libraries/classes/Plugins/Export/ExportCodegen.php +++ b/libraries/classes/Plugins/Export/ExportCodegen.php @@ -94,20 +94,16 @@ class ExportCodegen extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { return true; } /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -117,10 +113,8 @@ class ExportCodegen extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -129,10 +123,8 @@ class ExportCodegen extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -143,10 +135,8 @@ class ExportCodegen extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -160,8 +150,6 @@ class ExportCodegen extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -170,7 +158,7 @@ class ExportCodegen extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { $format = (int) $GLOBALS['codegen_format']; if ($format === self::HANDLER_NHIBERNATE_CS) { diff --git a/libraries/classes/Plugins/Export/ExportCsv.php b/libraries/classes/Plugins/Export/ExportCsv.php index 8c246cc88d..9834da414b 100644 --- a/libraries/classes/Plugins/Export/ExportCsv.php +++ b/libraries/classes/Plugins/Export/ExportCsv.php @@ -105,10 +105,8 @@ class ExportCsv extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { global $what, $csv_terminated, $csv_separator, $csv_enclosed, $csv_escaped; //Enable columns names by default for CSV @@ -167,10 +165,8 @@ class ExportCsv extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -180,10 +176,8 @@ class ExportCsv extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Alias of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -192,10 +186,8 @@ class ExportCsv extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -206,10 +198,8 @@ class ExportCsv extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -223,8 +213,6 @@ class ExportCsv extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -233,7 +221,7 @@ class ExportCsv extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $what, $csv_terminated, $csv_separator, $csv_enclosed, $csv_escaped, $dbi; $db_alias = $db; @@ -360,8 +348,6 @@ class ExportCsv extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/ExportHtmlword.php b/libraries/classes/Plugins/Export/ExportHtmlword.php index 4136221467..a647e62409 100644 --- a/libraries/classes/Plugins/Export/ExportHtmlword.php +++ b/libraries/classes/Plugins/Export/ExportHtmlword.php @@ -98,10 +98,8 @@ class ExportHtmlword extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { global $charset; @@ -123,10 +121,8 @@ class ExportHtmlword extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return $this->export->outputHandler('</body></html>'); } @@ -136,10 +132,8 @@ class ExportHtmlword extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -154,10 +148,8 @@ class ExportHtmlword extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -168,10 +160,8 @@ class ExportHtmlword extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -185,8 +175,6 @@ class ExportHtmlword extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -195,7 +183,7 @@ class ExportHtmlword extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $what, $dbi; $db_alias = $db; @@ -555,8 +543,6 @@ class ExportHtmlword extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -570,7 +556,7 @@ class ExportHtmlword extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; diff --git a/libraries/classes/Plugins/Export/ExportJson.php b/libraries/classes/Plugins/Export/ExportJson.php index f313e9b658..66159b9197 100644 --- a/libraries/classes/Plugins/Export/ExportJson.php +++ b/libraries/classes/Plugins/Export/ExportJson.php @@ -113,10 +113,8 @@ class ExportJson extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { global $crlf; @@ -136,10 +134,8 @@ class ExportJson extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { global $crlf; @@ -151,10 +147,8 @@ class ExportJson extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { global $crlf; @@ -174,10 +168,8 @@ class ExportJson extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -188,10 +180,8 @@ class ExportJson extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -205,8 +195,6 @@ class ExportJson extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -215,7 +203,7 @@ class ExportJson extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -263,8 +251,6 @@ class ExportJson extends ExportPlugin * } * } * }|array|null $aliases - * - * @return bool False on export fail and true on export end success */ protected function doExportForQuery( DatabaseInterface $dbi, @@ -365,8 +351,6 @@ class ExportJson extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/ExportLatex.php b/libraries/classes/Plugins/Export/ExportLatex.php index 0e46d7ff41..27a9bc5a05 100644 --- a/libraries/classes/Plugins/Export/ExportLatex.php +++ b/libraries/classes/Plugins/Export/ExportLatex.php @@ -202,10 +202,8 @@ class ExportLatex extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { global $crlf, $cfg, $dbi; @@ -229,10 +227,8 @@ class ExportLatex extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -242,10 +238,8 @@ class ExportLatex extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -263,10 +257,8 @@ class ExportLatex extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -277,10 +269,8 @@ class ExportLatex extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -294,8 +284,6 @@ class ExportLatex extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -304,7 +292,7 @@ class ExportLatex extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -458,8 +446,6 @@ class ExportLatex extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the seperator for a file - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { @@ -486,8 +472,6 @@ class ExportLatex extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -501,7 +485,7 @@ class ExportLatex extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; diff --git a/libraries/classes/Plugins/Export/ExportMediawiki.php b/libraries/classes/Plugins/Export/ExportMediawiki.php index a0e38a95a2..2b6b7db736 100644 --- a/libraries/classes/Plugins/Export/ExportMediawiki.php +++ b/libraries/classes/Plugins/Export/ExportMediawiki.php @@ -97,20 +97,16 @@ class ExportMediawiki extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { return true; } /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -120,10 +116,8 @@ class ExportMediawiki extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Alias of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -132,10 +126,8 @@ class ExportMediawiki extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -146,10 +138,8 @@ class ExportMediawiki extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -174,8 +164,6 @@ class ExportMediawiki extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -189,7 +177,7 @@ class ExportMediawiki extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -276,8 +264,6 @@ class ExportMediawiki extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -286,7 +272,7 @@ class ExportMediawiki extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -363,8 +349,6 @@ class ExportMediawiki extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/ExportOds.php b/libraries/classes/Plugins/Export/ExportOds.php index 6d9e604ebd..076c47fed1 100644 --- a/libraries/classes/Plugins/Export/ExportOds.php +++ b/libraries/classes/Plugins/Export/ExportOds.php @@ -87,10 +87,8 @@ class ExportOds extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>' . '<office:document-content ' @@ -143,10 +141,8 @@ class ExportOds extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { $GLOBALS['ods_buffer'] .= '</office:spreadsheet>' . '</office:body>' @@ -165,10 +161,8 @@ class ExportOds extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -177,10 +171,8 @@ class ExportOds extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -191,10 +183,8 @@ class ExportOds extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -208,8 +198,6 @@ class ExportOds extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -218,7 +206,7 @@ class ExportOds extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $what, $dbi; $db_alias = $db; @@ -344,8 +332,6 @@ class ExportOds extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/ExportOdt.php b/libraries/classes/Plugins/Export/ExportOdt.php index b98f088bee..1b1c6f3195 100644 --- a/libraries/classes/Plugins/Export/ExportOdt.php +++ b/libraries/classes/Plugins/Export/ExportOdt.php @@ -149,10 +149,8 @@ class ExportOdt extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="utf-8"?' . '>' . '<office:document-content ' @@ -165,10 +163,8 @@ class ExportOdt extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { $GLOBALS['odt_buffer'] .= '</office:text>' . '</office:body>' @@ -185,10 +181,8 @@ class ExportOdt extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -206,10 +200,8 @@ class ExportOdt extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -220,10 +212,8 @@ class ExportOdt extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -237,8 +227,6 @@ class ExportOdt extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -247,7 +235,7 @@ class ExportOdt extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $what, $dbi; $db_alias = $db; @@ -354,8 +342,6 @@ class ExportOdt extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { @@ -446,8 +432,6 @@ class ExportOdt extends ExportPlugin * the end * @param bool $view whether we're handling a view * @param array $aliases Aliases of db/table/columns - * - * @return bool true */ public function getTableDef( $db, @@ -461,7 +445,7 @@ class ExportOdt extends ExportPlugin $add_semicolon = true, $view = false, array $aliases = [] - ) { + ): bool { global $cfgRelation, $dbi; $db_alias = $db; @@ -693,8 +677,6 @@ class ExportOdt extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -708,7 +690,7 @@ class ExportOdt extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; diff --git a/libraries/classes/Plugins/Export/ExportPdf.php b/libraries/classes/Plugins/Export/ExportPdf.php index 424a5696aa..df91281f7c 100644 --- a/libraries/classes/Plugins/Export/ExportPdf.php +++ b/libraries/classes/Plugins/Export/ExportPdf.php @@ -107,10 +107,8 @@ class ExportPdf extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $pdf = $this->getPdf(); $pdf->Open(); @@ -124,10 +122,8 @@ class ExportPdf extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { $pdf = $this->getPdf(); @@ -140,10 +136,8 @@ class ExportPdf extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -152,10 +146,8 @@ class ExportPdf extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -166,10 +158,8 @@ class ExportPdf extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -183,8 +173,6 @@ class ExportPdf extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -193,7 +181,7 @@ class ExportPdf extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { $db_alias = $db; $table_alias = $table; $this->initAlias($aliases, $db_alias, $table_alias); @@ -215,8 +203,6 @@ class ExportPdf extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { @@ -249,8 +235,6 @@ class ExportPdf extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases aliases for db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -264,7 +248,7 @@ class ExportPdf extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { $db_alias = $db; $table_alias = $table; $purpose = ''; diff --git a/libraries/classes/Plugins/Export/ExportPhparray.php b/libraries/classes/Plugins/Export/ExportPhparray.php index 64a739c688..15b17d3301 100644 --- a/libraries/classes/Plugins/Export/ExportPhparray.php +++ b/libraries/classes/Plugins/Export/ExportPhparray.php @@ -79,10 +79,8 @@ class ExportPhparray extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $this->export->outputHandler( '<?php' . $GLOBALS['crlf'] @@ -97,10 +95,8 @@ class ExportPhparray extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -110,10 +106,8 @@ class ExportPhparray extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -132,10 +126,8 @@ class ExportPhparray extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -146,10 +138,8 @@ class ExportPhparray extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -163,8 +153,6 @@ class ExportPhparray extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -173,7 +161,7 @@ class ExportPhparray extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -274,8 +262,6 @@ class ExportPhparray extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/ExportSql.php b/libraries/classes/Plugins/Export/ExportSql.php index cb1677d397..dfc91f6ccb 100644 --- a/libraries/classes/Plugins/Export/ExportSql.php +++ b/libraries/classes/Plugins/Export/ExportSql.php @@ -601,10 +601,8 @@ class ExportSql extends ExportPlugin * * @param string $db Database * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ - public function exportRoutines($db, array $aliases = []) + public function exportRoutines($db, array $aliases = []): bool { global $crlf, $dbi; @@ -706,10 +704,8 @@ class ExportSql extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { global $crlf, $dbi; @@ -746,10 +742,8 @@ class ExportSql extends ExportPlugin /** * Outputs export header. It is the first method to be called, so all * the required variables are initialized here. - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { global $crlf, $cfg, $dbi; @@ -861,10 +855,8 @@ class ExportSql extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { global $crlf, $dbi; @@ -930,10 +922,8 @@ class ExportSql extends ExportPlugin * * @param string $db db to use * @param string $compat sql compatibility - * - * @return bool Whether it succeeded */ - private function exportUseStatement($db, $compat) + private function exportUseStatement($db, $compat): bool { global $crlf; @@ -962,10 +952,8 @@ class ExportSql extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Alias of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -995,10 +983,8 @@ class ExportSql extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { global $crlf; @@ -1029,10 +1015,8 @@ class ExportSql extends ExportPlugin * Exports events * * @param string $db Database - * - * @return bool Whether it succeeded */ - public function exportEvents($db) + public function exportEvents($db): bool { global $crlf, $dbi; @@ -1080,14 +1064,12 @@ class ExportSql extends ExportPlugin * @param string $db database being exported * @param string|array $tables table(s) being exported * @param array $metadataTypes types of metadata to export - * - * @return bool Whether it succeeded */ public function exportMetadata( $db, $tables, array $metadataTypes - ) { + ): bool { $cfgRelation = $this->relation->getRelationsParam(); if (! isset($cfgRelation['db'])) { return true; @@ -1134,14 +1116,12 @@ class ExportSql extends ExportPlugin * @param string $db database being exported * @param string|null $table table being exported * @param array $metadataTypes types of metadata to export - * - * @return bool Whether it succeeded */ private function exportConfigurationMetadata( $db, $table, array $metadataTypes - ) { + ): bool { global $dbi; $cfgRelation = $this->relation->getRelationsParam(); @@ -2139,8 +2119,6 @@ class ExportSql extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the seperator for a file - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { @@ -2167,8 +2145,6 @@ class ExportSql extends ExportPlugin * @param bool $mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -2182,7 +2158,7 @@ class ExportSql extends ExportPlugin $mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $dbAlias = $db; @@ -2355,8 +2331,6 @@ class ExportSql extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -2365,7 +2339,7 @@ class ExportSql extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $current_row, $sql_backquotes, $dbi; // Do not export data for merge tables diff --git a/libraries/classes/Plugins/Export/ExportTexytext.php b/libraries/classes/Plugins/Export/ExportTexytext.php index 8ce3a2d864..e0f3a26a7e 100644 --- a/libraries/classes/Plugins/Export/ExportTexytext.php +++ b/libraries/classes/Plugins/Export/ExportTexytext.php @@ -97,20 +97,16 @@ class ExportTexytext extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { return true; } /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { return true; } @@ -120,10 +116,8 @@ class ExportTexytext extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Alias of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { if (empty($dbAlias)) { $dbAlias = $db; @@ -138,10 +132,8 @@ class ExportTexytext extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -152,10 +144,8 @@ class ExportTexytext extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -169,8 +159,6 @@ class ExportTexytext extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -179,7 +167,7 @@ class ExportTexytext extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $what, $dbi; $db_alias = $db; @@ -260,8 +248,6 @@ class ExportTexytext extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { @@ -524,8 +510,6 @@ class ExportTexytext extends ExportPlugin * @param bool $do_mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -539,7 +523,7 @@ class ExportTexytext extends ExportPlugin $do_mime = false, $dates = false, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; diff --git a/libraries/classes/Plugins/Export/ExportXml.php b/libraries/classes/Plugins/Export/ExportXml.php index 10c60e7f05..15ff0e82ef 100644 --- a/libraries/classes/Plugins/Export/ExportXml.php +++ b/libraries/classes/Plugins/Export/ExportXml.php @@ -207,10 +207,8 @@ class ExportXml extends ExportPlugin /** * Outputs export header. It is the first method to be called, so all * the required variables are initialized here. - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $this->initSpecificVariables(); global $crlf, $cfg, $db, $dbi; @@ -387,10 +385,8 @@ class ExportXml extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { $foot = '</pma_xml_export>'; @@ -402,10 +398,8 @@ class ExportXml extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { global $crlf; @@ -433,10 +427,8 @@ class ExportXml extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { global $crlf; @@ -456,10 +448,8 @@ class ExportXml extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -473,8 +463,6 @@ class ExportXml extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -483,7 +471,7 @@ class ExportXml extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; // Do not export data for merge tables diff --git a/libraries/classes/Plugins/Export/ExportYaml.php b/libraries/classes/Plugins/Export/ExportYaml.php index 40165dd342..02eeaa0797 100644 --- a/libraries/classes/Plugins/Export/ExportYaml.php +++ b/libraries/classes/Plugins/Export/ExportYaml.php @@ -66,10 +66,8 @@ class ExportYaml extends ExportPlugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - public function exportHeader() + public function exportHeader(): bool { $this->export->outputHandler( '%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf'] @@ -80,10 +78,8 @@ class ExportYaml extends ExportPlugin /** * Outputs export footer - * - * @return bool Whether it succeeded */ - public function exportFooter() + public function exportFooter(): bool { $this->export->outputHandler('...' . $GLOBALS['crlf']); @@ -95,10 +91,8 @@ class ExportYaml extends ExportPlugin * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBHeader($db, $dbAlias = '') + public function exportDBHeader($db, $dbAlias = ''): bool { return true; } @@ -107,10 +101,8 @@ class ExportYaml extends ExportPlugin * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - public function exportDBFooter($db) + public function exportDBFooter($db): bool { return true; } @@ -121,10 +113,8 @@ class ExportYaml extends ExportPlugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - public function exportDBCreate($db, $exportType, $dbAlias = '') + public function exportDBCreate($db, $exportType, $dbAlias = ''): bool { return true; } @@ -138,8 +128,6 @@ class ExportYaml extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportData( $db, @@ -148,7 +136,7 @@ class ExportYaml extends ExportPlugin $errorUrl, $sqlQuery, array $aliases = [] - ) { + ): bool { global $dbi; $db_alias = $db; @@ -236,8 +224,6 @@ class ExportYaml extends ExportPlugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the end of line sequence - * - * @return bool if succeeded */ public function exportRawQuery(string $errorUrl, string $sqlQuery, string $crlf): bool { diff --git a/libraries/classes/Plugins/Export/Helpers/Pdf.php b/libraries/classes/Plugins/Export/Helpers/Pdf.php index 8bc315cb1f..57c51bf618 100644 --- a/libraries/classes/Plugins/Export/Helpers/Pdf.php +++ b/libraries/classes/Plugins/Export/Helpers/Pdf.php @@ -140,10 +140,8 @@ class Pdf extends PdfLib * position * @param bool $addpage if true add a page, otherwise only return * the true/false state - * - * @return bool true in case of page break, false otherwise. */ - public function checkPageBreak($h = 0, $y = '', $addpage = true) + public function checkPageBreak($h = 0, $y = '', $addpage = true): bool { if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; diff --git a/libraries/classes/Plugins/Export/Helpers/TableProperty.php b/libraries/classes/Plugins/Export/Helpers/TableProperty.php index 106ce4f8dd..5866d21704 100644 --- a/libraries/classes/Plugins/Export/Helpers/TableProperty.php +++ b/libraries/classes/Plugins/Export/Helpers/TableProperty.php @@ -212,8 +212,6 @@ class TableProperty /** * Tells whether the key is primary or not - * - * @return bool true if the key is primary, false otherwise */ public function isPK(): bool { diff --git a/libraries/classes/Plugins/ExportPlugin.php b/libraries/classes/Plugins/ExportPlugin.php index 1eb8670ad0..519b8b6e78 100644 --- a/libraries/classes/Plugins/ExportPlugin.php +++ b/libraries/classes/Plugins/ExportPlugin.php @@ -52,36 +52,28 @@ abstract class ExportPlugin implements Plugin /** * Outputs export header - * - * @return bool Whether it succeeded */ - abstract public function exportHeader(); + abstract public function exportHeader(): bool; /** * Outputs export footer - * - * @return bool Whether it succeeded */ - abstract public function exportFooter(); + abstract public function exportFooter(): bool; /** * Outputs database header * * @param string $db Database name * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - abstract public function exportDBHeader($db, $dbAlias = ''); + abstract public function exportDBHeader($db, $dbAlias = ''): bool; /** * Outputs database footer * * @param string $db Database name - * - * @return bool Whether it succeeded */ - abstract public function exportDBFooter($db); + abstract public function exportDBFooter($db): bool; /** * Outputs CREATE DATABASE statement @@ -89,10 +81,8 @@ abstract class ExportPlugin implements Plugin * @param string $db Database name * @param string $exportType 'server', 'database', 'table' * @param string $dbAlias Aliases of db - * - * @return bool Whether it succeeded */ - abstract public function exportDBCreate($db, $exportType, $dbAlias = ''); + abstract public function exportDBCreate($db, $exportType, $dbAlias = ''): bool; /** * Outputs the content of a table @@ -103,8 +93,6 @@ abstract class ExportPlugin implements Plugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery SQL query for obtaining data * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ abstract public function exportData( $db, @@ -113,7 +101,7 @@ abstract class ExportPlugin implements Plugin $errorUrl, $sqlQuery, array $aliases = [] - ); + ): bool; /** * The following methods are used in /export or in /database/operations, @@ -125,10 +113,8 @@ abstract class ExportPlugin implements Plugin * * @param string $db Database * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ - public function exportRoutines($db, array $aliases = []) + public function exportRoutines($db, array $aliases = []): bool { return true; } @@ -137,10 +123,8 @@ abstract class ExportPlugin implements Plugin * Exports events * * @param string $db Database - * - * @return bool Whether it succeeded */ - public function exportEvents($db) + public function exportEvents($db): bool { return true; } @@ -151,8 +135,6 @@ abstract class ExportPlugin implements Plugin * @param string $errorUrl the url to go back in case of error * @param string $sqlQuery the rawquery to output * @param string $crlf the seperator for a file - * - * @return bool if succeeded */ public function exportRawQuery( string $errorUrl, @@ -181,8 +163,6 @@ abstract class ExportPlugin implements Plugin * @param bool $mime whether to include mime comments * @param bool $dates whether to include creation/update/check dates * @param array $aliases Aliases of db/table/columns - * - * @return bool Whether it succeeded */ public function exportStructure( $db, @@ -196,7 +176,7 @@ abstract class ExportPlugin implements Plugin $mime = false, $dates = false, array $aliases = [] - ) { + ): bool { return true; } @@ -206,14 +186,12 @@ abstract class ExportPlugin implements Plugin * @param string $db database being exported * @param string|array $tables table(s) being exported * @param array $metadataTypes types of metadata to export - * - * @return bool Whether it succeeded */ public function exportMetadata( $db, $tables, array $metadataTypes - ) { + ): bool { return true; } diff --git a/libraries/classes/Plugins/IOTransformationsPlugin.php b/libraries/classes/Plugins/IOTransformationsPlugin.php index 2fd74e1859..36354f1502 100644 --- a/libraries/classes/Plugins/IOTransformationsPlugin.php +++ b/libraries/classes/Plugins/IOTransformationsPlugin.php @@ -80,10 +80,8 @@ abstract class IOTransformationsPlugin extends TransformationsPlugin /** * Returns the success status - * - * @return bool */ - public function isSuccess() + public function isSuccess(): bool { return $this->success; } diff --git a/libraries/classes/Plugins/Import/ImportCsv.php b/libraries/classes/Plugins/Import/ImportCsv.php index c0a22bd62d..8b346a8492 100644 --- a/libraries/classes/Plugins/Import/ImportCsv.php +++ b/libraries/classes/Plugins/Import/ImportCsv.php @@ -944,10 +944,8 @@ class ImportCsv extends AbstractImportCsv /** * Returns true if the table should be analyzed, false otherwise - * - * @return bool */ - private function getAnalyze() + private function getAnalyze(): bool { return $this->analyze; } diff --git a/libraries/classes/Plugins/Import/ImportMediawiki.php b/libraries/classes/Plugins/Import/ImportMediawiki.php index 1314da422d..4500a18e0a 100644 --- a/libraries/classes/Plugins/Import/ImportMediawiki.php +++ b/libraries/classes/Plugins/Import/ImportMediawiki.php @@ -532,10 +532,8 @@ class ImportMediawiki extends ImportPlugin /** * Returns true if the table should be analyzed, false otherwise - * - * @return bool */ - private function getAnalyze() + private function getAnalyze(): bool { return $this->analyze; } @@ -579,10 +577,8 @@ class ImportMediawiki extends ImportPlugin * Manage $inside_structure_comment * * @param bool $inside_structure_comment Value to test - * - * @return bool */ - private function mngInsideStructComm($inside_structure_comment) + private function mngInsideStructComm($inside_structure_comment): bool { // End ignoring structure rows if ($inside_structure_comment) { diff --git a/libraries/classes/Plugins/Schema/ExportRelationSchema.php b/libraries/classes/Plugins/Schema/ExportRelationSchema.php index 981f1de7ae..2df3c56e2a 100644 --- a/libraries/classes/Plugins/Schema/ExportRelationSchema.php +++ b/libraries/classes/Plugins/Schema/ExportRelationSchema.php @@ -103,10 +103,8 @@ class ExportRelationSchema /** * Returns whether to show colors - * - * @return bool whether to show colors */ - public function isShowColor() + public function isShowColor(): bool { return $this->showColor; } @@ -123,10 +121,8 @@ class ExportRelationSchema /** * Returns whether to show table dimensions - * - * @return bool whether to show table dimensions */ - public function isTableDimension() + public function isTableDimension(): bool { return $this->tableDimension; } @@ -143,10 +139,8 @@ class ExportRelationSchema /** * Returns whether to use same width for all tables or not - * - * @return bool whether to use same width for all tables or not */ - public function isAllTableSameWidth() + public function isAllTableSameWidth(): bool { return $this->sameWide; } @@ -165,10 +159,8 @@ class ExportRelationSchema /** * Returns whether to show keys - * - * @return bool whether to show keys */ - public function isShowKeys() + public function isShowKeys(): bool { return $this->showKeys; } @@ -232,11 +224,9 @@ class ExportRelationSchema /** * Returns whether the client side database is used * - * @return bool - * * @access public */ - public function isOffline() + public function isOffline(): bool { return $this->offline; } diff --git a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php index 2c32582e6d..c392ef471d 100644 --- a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -282,10 +282,8 @@ class PdfRelationSchema extends ExportRelationSchema /** * Returns whether to show grid - * - * @return bool whether to show grid */ - public function isShowGrid() + public function isShowGrid(): bool { return $this->showGrid; } @@ -302,10 +300,8 @@ class PdfRelationSchema extends ExportRelationSchema /** * Return whether to show selected database data dictionary or not - * - * @return bool whether to show selected database data dictionary or not */ - public function isWithDataDictionary() + public function isWithDataDictionary(): bool { return $this->withDoc; } diff --git a/libraries/classes/Plugins/Schema/SchemaDia.php b/libraries/classes/Plugins/Schema/SchemaDia.php index 6b70a0ec8c..9dfd139874 100644 --- a/libraries/classes/Plugins/Schema/SchemaDia.php +++ b/libraries/classes/Plugins/Schema/SchemaDia.php @@ -83,10 +83,8 @@ class SchemaDia extends SchemaPlugin * Exports the schema into DIA format. * * @param string $db database name - * - * @return bool Whether it succeeded */ - public function exportSchema($db) + public function exportSchema($db): bool { $export = new DiaRelationSchema($db); $export->showOutput(); diff --git a/libraries/classes/Plugins/Schema/SchemaEps.php b/libraries/classes/Plugins/Schema/SchemaEps.php index 720da6fce1..0770588dc7 100644 --- a/libraries/classes/Plugins/Schema/SchemaEps.php +++ b/libraries/classes/Plugins/Schema/SchemaEps.php @@ -84,10 +84,8 @@ class SchemaEps extends SchemaPlugin * Exports the schema into EPS format. * * @param string $db database name - * - * @return bool Whether it succeeded */ - public function exportSchema($db) + public function exportSchema($db): bool { $export = new EpsRelationSchema($db); $export->showOutput(); diff --git a/libraries/classes/Plugins/Schema/SchemaPdf.php b/libraries/classes/Plugins/Schema/SchemaPdf.php index 0ab99531c5..d45af9b858 100644 --- a/libraries/classes/Plugins/Schema/SchemaPdf.php +++ b/libraries/classes/Plugins/Schema/SchemaPdf.php @@ -118,10 +118,8 @@ class SchemaPdf extends SchemaPlugin * Exports the schema into PDF format. * * @param string $db database name - * - * @return bool Whether it succeeded */ - public function exportSchema($db) + public function exportSchema($db): bool { $export = new PdfRelationSchema($db); $export->showOutput(); diff --git a/libraries/classes/Plugins/Schema/SchemaSvg.php b/libraries/classes/Plugins/Schema/SchemaSvg.php index ef6489b1b6..f0ba694a1b 100644 --- a/libraries/classes/Plugins/Schema/SchemaSvg.php +++ b/libraries/classes/Plugins/Schema/SchemaSvg.php @@ -71,10 +71,8 @@ class SchemaSvg extends SchemaPlugin * Exports the schema into SVG format. * * @param string $db database name - * - * @return bool Whether it succeeded */ - public function exportSchema($db) + public function exportSchema($db): bool { $export = new SvgRelationSchema($db); $export->showOutput(); diff --git a/libraries/classes/Plugins/SchemaPlugin.php b/libraries/classes/Plugins/SchemaPlugin.php index 77953236e4..ae3e393e34 100644 --- a/libraries/classes/Plugins/SchemaPlugin.php +++ b/libraries/classes/Plugins/SchemaPlugin.php @@ -61,10 +61,8 @@ abstract class SchemaPlugin implements Plugin * Exports the schema into the specified format. * * @param string $db database name - * - * @return bool Whether it succeeded */ - abstract public function exportSchema($db); + abstract public function exportSchema($db): bool; /** * Adds export options common to all plugins. diff --git a/libraries/classes/Plugins/TwoFactor/Application.php b/libraries/classes/Plugins/TwoFactor/Application.php index 11687ececb..573df70446 100644 --- a/libraries/classes/Plugins/TwoFactor/Application.php +++ b/libraries/classes/Plugins/TwoFactor/Application.php @@ -55,13 +55,11 @@ class Application extends TwoFactorPlugin /** * Checks authentication, returns true on success * - * @return bool - * * @throws IncompatibleWithGoogleAuthenticatorException * @throws InvalidCharactersException * @throws SecretKeyTooShortException */ - public function check() + public function check(): bool { $this->provided = false; if (! isset($_POST['2fa_code'])) { @@ -70,7 +68,7 @@ class Application extends TwoFactorPlugin $this->provided = true; - return $this->google2fa->verifyKey( + return (bool) $this->google2fa->verifyKey( $this->twofactor->config['settings']['secret'], $_POST['2fa_code'] ); @@ -110,13 +108,11 @@ class Application extends TwoFactorPlugin /** * Performs backend configuration * - * @return bool - * * @throws IncompatibleWithGoogleAuthenticatorException * @throws InvalidCharactersException * @throws SecretKeyTooShortException */ - public function configure() + public function configure(): bool { if (! isset($_SESSION['2fa_application_key'])) { $_SESSION['2fa_application_key'] = $this->google2fa->generateSecretKey(); diff --git a/libraries/classes/Plugins/TwoFactor/Invalid.php b/libraries/classes/Plugins/TwoFactor/Invalid.php index 5aea4363e0..def3535432 100644 --- a/libraries/classes/Plugins/TwoFactor/Invalid.php +++ b/libraries/classes/Plugins/TwoFactor/Invalid.php @@ -22,10 +22,8 @@ class Invalid extends TwoFactorPlugin /** * Checks authentication, returns true on success - * - * @return bool */ - public function check() + public function check(): bool { return false; } diff --git a/libraries/classes/Plugins/TwoFactor/Key.php b/libraries/classes/Plugins/TwoFactor/Key.php index 4f46d09948..ae2204e84b 100644 --- a/libraries/classes/Plugins/TwoFactor/Key.php +++ b/libraries/classes/Plugins/TwoFactor/Key.php @@ -70,10 +70,8 @@ class Key extends TwoFactorPlugin /** * Checks authentication, returns true on success - * - * @return bool */ - public function check() + public function check(): bool { $this->provided = false; if (! isset($_POST['u2f_authentication_response'], $_SESSION['authenticationRequest'])) { @@ -164,10 +162,8 @@ class Key extends TwoFactorPlugin /** * Performs backend configuration - * - * @return bool */ - public function configure() + public function configure(): bool { $this->provided = false; if (! isset($_POST['u2f_registration_response'], $_SESSION['registrationRequest'])) { diff --git a/libraries/classes/Plugins/TwoFactor/Simple.php b/libraries/classes/Plugins/TwoFactor/Simple.php index f96c4c25b7..0790c2062b 100644 --- a/libraries/classes/Plugins/TwoFactor/Simple.php +++ b/libraries/classes/Plugins/TwoFactor/Simple.php @@ -23,10 +23,8 @@ class Simple extends TwoFactorPlugin /** * Checks authentication, returns true on success - * - * @return bool */ - public function check() + public function check(): bool { return isset($_POST['2fa_confirm']); } diff --git a/libraries/classes/Plugins/TwoFactorPlugin.php b/libraries/classes/Plugins/TwoFactorPlugin.php index 0b3ab1c767..38f8bcfab2 100644 --- a/libraries/classes/Plugins/TwoFactorPlugin.php +++ b/libraries/classes/Plugins/TwoFactorPlugin.php @@ -84,10 +84,8 @@ class TwoFactorPlugin /** * Checks authentication, returns true on success - * - * @return bool */ - public function check() + public function check(): bool { return true; } @@ -114,10 +112,8 @@ class TwoFactorPlugin /** * Performs backend configuration - * - * @return bool */ - public function configure() + public function configure(): bool { return true; } diff --git a/libraries/classes/Profiling.php b/libraries/classes/Profiling.php index 983075f9c0..4ad63cf780 100644 --- a/libraries/classes/Profiling.php +++ b/libraries/classes/Profiling.php @@ -16,7 +16,7 @@ final class Profiling public static function isSupported(DatabaseInterface $dbi): bool { if (SessionCache::has('profiling_supported')) { - return SessionCache::get('profiling_supported'); + return (bool) SessionCache::get('profiling_supported'); } /** diff --git a/libraries/classes/RecentFavoriteTable.php b/libraries/classes/RecentFavoriteTable.php index f16dfcb0fb..f4d38d756c 100644 --- a/libraries/classes/RecentFavoriteTable.php +++ b/libraries/classes/RecentFavoriteTable.php @@ -176,8 +176,6 @@ class RecentFavoriteTable /** * Trim recent.favorite table according to the * NumRecentTables/NumFavoriteTables configuration. - * - * @return bool True if trimming occurred */ public function trim(): bool { diff --git a/libraries/classes/Relation.php b/libraries/classes/Relation.php index 0869cd9549..5442d4f762 100644 --- a/libraries/classes/Relation.php +++ b/libraries/classes/Relation.php @@ -740,8 +740,6 @@ class Relation * Check if the table is accessible * * @param string $tableDbName The table or table.db - * - * @return bool The table is accessible */ public function canAccessStorageTable(string $tableDbName): bool { @@ -758,11 +756,9 @@ class Relation * Check whether column_info table input transformation * upgrade is required and try to upgrade silently * - * @return bool false if upgrade failed - * * @access public */ - public function tryUpgradeTransformations() + public function tryUpgradeTransformations(): bool { // From 4.3, new input oriented transformation feature was introduced. // Check whether column_info table has input transformation columns @@ -1090,11 +1086,9 @@ class Relation * @param string $db the name of the db * @param string $comment the value of the column * - * @return bool true, if comment-query was made. - * * @access public */ - public function setDbComment($db, $comment = '') + public function setDbComment($db, $comment = ''): bool { $cfgRelation = $this->getRelationsParam(); @@ -1124,7 +1118,7 @@ class Relation AND `column_name` = \'(db_comment)\''; } - return $this->queryAsControlUser($upd_query); + return (bool) $this->queryAsControlUser($upd_query); } /** @@ -2309,10 +2303,8 @@ class Relation /** * Verifies if all the pmadb tables are defined - * - * @return bool */ - public function arePmadbTablesDefined() + public function arePmadbTablesDefined(): bool { return ! (empty($GLOBALS['cfg']['Server']['bookmarktable']) || empty($GLOBALS['cfg']['Server']['relation']) diff --git a/libraries/classes/ResponseRenderer.php b/libraries/classes/ResponseRenderer.php index 23b24fa542..b4bc8d1739 100644 --- a/libraries/classes/ResponseRenderer.php +++ b/libraries/classes/ResponseRenderer.php @@ -442,10 +442,8 @@ class ResponseRenderer /** * Wrapper around PHP's headers_sent() function. - * - * @return bool */ - public function headersSent() + public function headersSent(): bool { return headers_sent(); } @@ -501,7 +499,7 @@ class ResponseRenderer * * @return bool Whether caller should exit */ - public function loginPage() + public function loginPage(): bool { /* Handle AJAX redirection */ if ($this->isAjax()) { diff --git a/libraries/classes/Sanitize.php b/libraries/classes/Sanitize.php index 4ef98d9bba..03900303af 100644 --- a/libraries/classes/Sanitize.php +++ b/libraries/classes/Sanitize.php @@ -40,10 +40,8 @@ class Sanitize * @param string $url URL to check * @param bool $http Whether to allow http links * @param bool $other Whether to allow ftp and mailto links - * - * @return bool True if string can be used as link */ - public static function checkLink($url, $http = false, $other = false) + public static function checkLink($url, $http = false, $other = false): bool { $url = strtolower($url); $valid_starts = [ diff --git a/libraries/classes/SavedSearches.php b/libraries/classes/SavedSearches.php index 6f60dc56cb..dc2cbc52b1 100644 --- a/libraries/classes/SavedSearches.php +++ b/libraries/classes/SavedSearches.php @@ -271,10 +271,8 @@ class SavedSearches /** * Save the search - * - * @return bool */ - public function save() + public function save(): bool { global $dbi; @@ -375,10 +373,8 @@ class SavedSearches /** * Delete the search - * - * @return bool */ - public function delete() + public function delete(): bool { global $dbi; @@ -404,10 +400,8 @@ class SavedSearches /** * Load the current search from an id. - * - * @return bool Success */ - public function load() + public function load(): bool { global $dbi; diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index 34dff64463..20604be896 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -3657,10 +3657,8 @@ class Privileges /** * Check if MariaDB's 'simple_password_check' * OR 'cracklib_password_check' is ACTIVE - * - * @return bool if at least one of the plugins is ACTIVE */ - public function checkIfMariaDBPwdCheckPluginActive() + public function checkIfMariaDBPwdCheckPluginActive(): bool { $serverVersion = $this->dbi->getVersion(); if (! (Compatibility::isMariaDb() && $serverVersion >= 100002)) { diff --git a/libraries/classes/Server/SysInfo/Base.php b/libraries/classes/Server/SysInfo/Base.php index 7da577cd86..771a62c1fa 100644 --- a/libraries/classes/Server/SysInfo/Base.php +++ b/libraries/classes/Server/SysInfo/Base.php @@ -40,10 +40,8 @@ class Base /** * Checks whether class is supported in this environment - * - * @return bool true on success */ - public function supported() + public function supported(): bool { return true; } diff --git a/libraries/classes/Server/SysInfo/Linux.php b/libraries/classes/Server/SysInfo/Linux.php index d3a0f09369..05a1ae2781 100644 --- a/libraries/classes/Server/SysInfo/Linux.php +++ b/libraries/classes/Server/SysInfo/Linux.php @@ -65,10 +65,8 @@ class Linux extends Base /** * Checks whether class is supported in this environment - * - * @return bool true on success */ - public function supported() + public function supported(): bool { return @is_readable('/proc/meminfo') && @is_readable('/proc/stat'); } diff --git a/libraries/classes/Server/SysInfo/SunOs.php b/libraries/classes/Server/SysInfo/SunOs.php index d6b052c83a..a89823e657 100644 --- a/libraries/classes/Server/SysInfo/SunOs.php +++ b/libraries/classes/Server/SysInfo/SunOs.php @@ -56,10 +56,8 @@ class SunOs extends Base /** * Checks whether class is supported in this environment - * - * @return bool true on success */ - public function supported() + public function supported(): bool { return @is_readable('/proc/meminfo'); } diff --git a/libraries/classes/Server/SysInfo/WindowsNt.php b/libraries/classes/Server/SysInfo/WindowsNt.php index 0143e4a6f5..621d694d01 100644 --- a/libraries/classes/Server/SysInfo/WindowsNt.php +++ b/libraries/classes/Server/SysInfo/WindowsNt.php @@ -63,10 +63,8 @@ class WindowsNt extends Base /** * Checks whether class is supported in this environment - * - * @return bool true on success */ - public function supported() + public function supported(): bool { return $this->wmi !== null; } diff --git a/libraries/classes/Setup/ConfigGenerator.php b/libraries/classes/Setup/ConfigGenerator.php index 3cbb3100a5..d252636efa 100644 --- a/libraries/classes/Setup/ConfigGenerator.php +++ b/libraries/classes/Setup/ConfigGenerator.php @@ -120,10 +120,8 @@ class ConfigGenerator * Check whether $array is a continuous 0-based array * * @param array $array Array to check - * - * @return bool */ - private static function isZeroBasedArray(array $array) + private static function isZeroBasedArray(array $array): bool { for ($i = 0, $nb = count($array); $i < $nb; $i++) { if (! isset($array[$i])) { diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index 5b1ca34f20..96e7b66b42 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -149,10 +149,8 @@ class Sql * Verify whether the result set has columns from just one table * * @param array $fieldsMeta meta fields - * - * @return bool whether the result set has columns from just one table */ - private function resultSetHasJustOneTable(array $fieldsMeta) + private function resultSetHasJustOneTable(array $fieldsMeta): bool { $justOneTable = true; $prevTable = ''; @@ -182,10 +180,8 @@ class Sql * @param string $db database name * @param string $table table name * @param array $fieldsMeta meta fields - * - * @return bool whether the result set contains a unique key */ - private function resultSetContainsUniqueKey(string $db, string $table, array $fieldsMeta) + private function resultSetContainsUniqueKey(string $db, string $table, array $fieldsMeta): bool { $columns = $this->dbi->getColumns($db, $table); $resultSetColumnNames = []; @@ -360,10 +356,8 @@ class Sql * * @param array $analyzedSqlResults the analyzed query and other variables set * after analyzing the query - * - * @return bool */ - private function isRememberSortingOrder(array $analyzedSqlResults) + private function isRememberSortingOrder(array $analyzedSqlResults): bool { return isset($analyzedSqlResults['select_expr'], $analyzedSqlResults['select_tables']) && $GLOBALS['cfg']['RememberSorting'] @@ -383,10 +377,8 @@ class Sql * * @param array $analyzedSqlResults the analyzed query and other variables set * after analyzing the query - * - * @return bool */ - private function isAppendLimitClause(array $analyzedSqlResults) + private function isAppendLimitClause(array $analyzedSqlResults): bool { // Assigning LIMIT clause to an syntactically-wrong query // is not needed. Also we would want to show the true query @@ -432,10 +424,8 @@ class Sql * * @param array $analyzedSqlResults the analyzed query and other variables set * after analyzing the query - * - * @return bool */ - private function isDeleteTransformationInfo(array $analyzedSqlResults) + private function isDeleteTransformationInfo(array $analyzedSqlResults): bool { return ! empty($analyzedSqlResults['querytype']) && (($analyzedSqlResults['querytype'] === 'ALTER') @@ -449,14 +439,12 @@ class Sql * after analyzing the query * @param bool $allowUserDropDatabase whether the user is allowed to drop db * @param bool $isSuperUser whether this user is a superuser - * - * @return bool */ public function hasNoRightsToDropDatabase( array $analyzedSqlResults, $allowUserDropDatabase, $isSuperUser - ) { + ): bool { return ! $allowUserDropDatabase && isset($analyzedSqlResults['drop_database']) && $analyzedSqlResults['drop_database'] diff --git a/libraries/classes/StorageEngine.php b/libraries/classes/StorageEngine.php index dcc1198f14..994bb82f22 100644 --- a/libraries/classes/StorageEngine.php +++ b/libraries/classes/StorageEngine.php @@ -139,8 +139,6 @@ class StorageEngine * This is public to be used in the StructureComtroller, the first release * of this function was looking Mroonga in the engines list but this second * method checks too that mroonga is installed successfully - * - * @return bool true when the mroonga_command is found */ public static function hasMroongaEngine(): bool { @@ -148,7 +146,7 @@ class StorageEngine $cacheKey = 'storage-engine.mroonga.has.mroonga_command'; if (Cache::has($cacheKey)) { - return Cache::get($cacheKey, false); + return (bool) Cache::get($cacheKey, false); } $supportsMroonga = $dbi->tryQuery('SELECT mroonga_command(\'object_list\');') !== false; @@ -307,11 +305,9 @@ class StorageEngine * * @param string $engine name of engine * - * @return bool whether $engine is valid or not - * * @static */ - public static function isValid($engine) + public static function isValid($engine): bool { if ($engine === 'PBMS') { return true; diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index bb4b24af4c..63cd41f78f 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -203,11 +203,8 @@ class Table implements Stringable * * @param array|string $engine Checks the table engine against an * array of engine strings or a single string, should be uppercase - * - * @return bool True, if $engine matches the storage engine for the table, - * False otherwise. */ - public function isEngine($engine) + public function isEngine($engine): bool { $tableStorageEngine = $this->getStorageEngine(); @@ -226,10 +223,8 @@ class Table implements Stringable /** * returns whether the table is actually a view - * - * @return bool whether the given is a view */ - public function isView() + public function isView(): bool { $db = $this->dbName; $table = $this->name; @@ -265,10 +260,8 @@ class Table implements Stringable /** * Returns whether the table is actually an updatable view - * - * @return bool whether the given is an updatable view */ - public function isUpdatableView() + public function isUpdatableView(): bool { if (empty($this->dbName) || empty($this->name)) { return false; @@ -290,10 +283,8 @@ class Table implements Stringable * * If the ENGINE of the table is MERGE or MRG_MYISAM (alias), * this is a merge table. - * - * @return bool true if it is a merge table */ - public function isMerge() + public function isMerge(): bool { return $this->isEngine(['MERGE', 'MRG_MYISAM']); } @@ -702,10 +693,8 @@ class Table implements Stringable * $min_records * * @param int $minRecords Number of records to check for in a table - * - * @return bool True, if at least $min_records exist, False otherwise. */ - public function checkIfMinRecordsExist($minRecords = 0) + public function checkIfMinRecordsExist($minRecords = 0): bool { $checkQuery = 'SELECT '; @@ -1004,8 +993,6 @@ class Table implements Stringable * @param string $what what to be moved or copied (data, dataonly) * @param bool $move whether to move * @param string $mode mode - * - * @return bool true if success, false otherwise */ public static function moveCopy( $sourceDb, @@ -1016,7 +1003,7 @@ class Table implements Stringable $move, $mode, bool $addDropIfExists - ) { + ): bool { global $errorUrl, $dbi; $relation = new Relation($dbi); @@ -1561,11 +1548,9 @@ class Table implements Stringable * @param string $tableName name to check * @param bool $isBackquoted whether this name is used inside backquotes or not * - * @return bool whether the string is valid or not - * * @todo add check for valid chars in filename on current system/os */ - public static function isValidName($tableName, $isBackquoted = false) + public static function isValidName($tableName, $isBackquoted = false): bool { if ($tableName !== rtrim((string) $tableName)) { // trailing spaces not allowed even in backquotes @@ -1597,10 +1582,8 @@ class Table implements Stringable * * @param string $newName new table name * @param string $newDb new database name - * - * @return bool success */ - public function rename($newName, $newDb = null) + public function rename($newName, $newDb = null): bool { if ($this->dbi->getLowerCaseNames() === '1') { $newName = strtolower($newName); @@ -2363,10 +2346,8 @@ class Table implements Stringable * * @param string $displayField display field * @param array $cfgRelation configuration relation - * - * @return bool True on update succeed or False on failure */ - public function updateDisplayField($displayField, array $cfgRelation) + public function updateDisplayField($displayField, array $cfgRelation): bool { if ($displayField == '') { $updQuery = 'DELETE FROM ' @@ -2403,8 +2384,6 @@ class Table implements Stringable * @param array $destinationColumn destination columns * @param array $cfgRelation configuration relation * @param array|null $existrel db, table, column - * - * @return bool */ public function updateInternalRelations( array $multiEditColumnsName, @@ -2413,7 +2392,7 @@ class Table implements Stringable array $destinationColumn, array $cfgRelation, $existrel - ) { + ): bool { $updated = false; foreach ($destinationDb as $masterFieldMd5 => $foreignDb) { $updQuery = null; diff --git a/libraries/classes/Theme.php b/libraries/classes/Theme.php index 33769a3a9d..fd4647ae9c 100644 --- a/libraries/classes/Theme.php +++ b/libraries/classes/Theme.php @@ -106,11 +106,9 @@ class Theme /** * Loads theme information * - * @return bool whether loading them info was successful or not - * * @access public */ - public function loadInfo() + public function loadInfo(): bool { $infofile = $this->getFsPath() . 'theme.json'; if (! @file_exists($infofile)) { @@ -183,11 +181,9 @@ class Theme /** * checks image path for existence - if not found use img from fallback theme * - * @return bool - * * @access public */ - public function checkImgPath() + public function checkImgPath(): bool { // try current theme first if (is_dir($this->getFsPath() . 'img' . DIRECTORY_SEPARATOR)) { @@ -295,11 +291,9 @@ class Theme * * @param string $version version to compare to * - * @return bool true if theme version is equal or higher to $version - * * @access public */ - public function checkVersion($version) + public function checkVersion($version): bool { return version_compare($this->getVersion(), $version, 'lt'); } diff --git a/libraries/classes/ThemeManager.php b/libraries/classes/ThemeManager.php index 26316ca168..bf791ffbe1 100644 --- a/libraries/classes/ThemeManager.php +++ b/libraries/classes/ThemeManager.php @@ -140,8 +140,6 @@ class ThemeManager * * @param string|null $theme theme name * - * @return bool true on success - * * @access public */ public function setActiveTheme(?string $theme): bool diff --git a/libraries/classes/Tracker.php b/libraries/classes/Tracker.php index e88079307a..c1f4ec3970 100644 --- a/libraries/classes/Tracker.php +++ b/libraries/classes/Tracker.php @@ -62,11 +62,9 @@ class Tracker /** * Gets the on/off value of the Tracker module, starts initialization. * - * @return bool (true=on|false=off) - * * @static */ - public static function isActive() + public static function isActive(): bool { global $dbi; @@ -126,11 +124,9 @@ class Tracker * @param string $dbName name of database * @param string $tableName name of table * - * @return bool true or false - * * @static */ - public static function isTracked($dbName, $tableName) + public static function isTracked($dbName, $tableName): bool { global $dbi; @@ -437,8 +433,6 @@ class Tracker * @param string $type type of data(DDL || DML) * @param string|array $newData the new tracking data * - * @return bool result of change - * * @static */ public static function changeTrackingData( @@ -447,7 +441,7 @@ class Tracker $version, $type, $newData - ) { + ): bool { global $dbi; $relation = new Relation($dbi); diff --git a/libraries/classes/Transformations.php b/libraries/classes/Transformations.php index 381e9adee9..fb63d5b03b 100644 --- a/libraries/classes/Transformations.php +++ b/libraries/classes/Transformations.php @@ -363,8 +363,6 @@ class Transformations * @param bool $forcedelete force delete, will erase any existing * comments for this column * - * @return bool true, if comment-query was made. - * * @access public */ public function setMime( @@ -377,7 +375,7 @@ class Transformations $inputTransform, $inputTransformOpts, $forcedelete = false - ) { + ): bool { global $dbi; $relation = new Relation($dbi); @@ -465,7 +463,7 @@ class Transformations } if (isset($upd_query)) { - return $relation->queryAsControlUser($upd_query); + return (bool) $relation->queryAsControlUser($upd_query); } return false; @@ -482,10 +480,8 @@ class Transformations * @param string $db Database name * @param string $table Table name * @param string $column Column name - * - * @return bool State of the query execution */ - public function clear($db, $table = '', $column = '') + public function clear($db, $table = '', $column = ''): bool { global $dbi; @@ -512,6 +508,6 @@ class Transformations $delete_sql .= '`db_name` = \'' . $db . '\' '; } - return $dbi->tryQuery($delete_sql); + return (bool) $dbi->tryQuery($delete_sql); } } diff --git a/libraries/classes/TwoFactor.php b/libraries/classes/TwoFactor.php index fcf192f3db..4531c37c28 100644 --- a/libraries/classes/TwoFactor.php +++ b/libraries/classes/TwoFactor.php @@ -203,10 +203,8 @@ class TwoFactor * Checks authentication, returns true on success * * @param bool $skipSession Skip session cache - * - * @return bool */ - public function check($skipSession = false) + public function check($skipSession = false): bool { if ($skipSession) { return $this->backend->check(); @@ -216,7 +214,7 @@ class TwoFactor $_SESSION['two_factor_check'] = $this->backend->check(); } - return $_SESSION['two_factor_check']; + return (bool) $_SESSION['two_factor_check']; } /** @@ -256,10 +254,8 @@ class TwoFactor * if configuration fails. * * @param string $name Backend name - * - * @return bool */ - public function configure($name) + public function configure($name): bool { $this->config = ['backend' => $name]; if ($name === '') { diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php index b1695d7ca1..fb688ac170 100644 --- a/libraries/classes/Types.php +++ b/libraries/classes/Types.php @@ -53,10 +53,8 @@ class Types * Check whether operator is unary. * * @param string $op operator name - * - * @return bool */ - public function isUnaryOperator($op) + public function isUnaryOperator($op): bool { return in_array($op, $this->getUnaryOperators()); } diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 0b272623c4..69edc45ff5 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -99,8 +99,6 @@ class Util * Checks whether configuration value tells to show icons. * * @param string $value Configuration option name - * - * @return bool Whether to show icons. */ public static function showIcons($value): bool { @@ -111,8 +109,6 @@ class Util * Checks whether configuration value tells to show text. * * @param string $value Configuration option name - * - * @return bool Whether to show text. */ public static function showText($value): bool { diff --git a/libraries/classes/Utils/ForeignKey.php b/libraries/classes/Utils/ForeignKey.php index 531dff3174..632a9c2e26 100644 --- a/libraries/classes/Utils/ForeignKey.php +++ b/libraries/classes/Utils/ForeignKey.php @@ -59,8 +59,6 @@ final class ForeignKey /** * Handle foreign key check request - * - * @return bool Default foreign key checks value */ public static function handleDisableCheckInit(): bool { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 563e97617b..6ce562baec 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -486,16 +486,6 @@ parameters: path: libraries/classes/IpAllowDeny.php - - message: "#^Method PhpMyAdmin\\\\Language\\:\\:matchesAcceptLanguage\\(\\) should return bool but returns int\\|false\\.$#" - count: 1 - path: libraries/classes/Language.php - - - - message: "#^Method PhpMyAdmin\\\\Language\\:\\:matchesUserAgent\\(\\) should return bool but returns int\\|false\\.$#" - count: 1 - path: libraries/classes/Language.php - - - message: "#^Method PhpMyAdmin\\\\LanguageManager\\:\\:availableLocales\\(\\) should return array but returns array\\|false\\.$#" count: 1 path: libraries/classes/LanguageManager.php @@ -826,11 +816,6 @@ parameters: path: libraries/classes/Plugins/Transformations/Output/Text_Plain_Binarytoip.php - - message: "#^Method PhpMyAdmin\\\\Plugins\\\\TwoFactor\\\\Application\\:\\:check\\(\\) should return bool but returns bool\\|int\\.$#" - count: 1 - path: libraries/classes/Plugins/TwoFactor/Application.php - - - message: "#^Method PhpMyAdmin\\\\Relation\\:\\:checkRelationsParam\\(\\) should return array\\<string\\> but returns array\\<string, bool\\|string\\|null\\>\\.$#" count: 1 path: libraries/classes/Relation.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 9d9a9a178b..67e5d22d67 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -96,10 +96,8 @@ <code>$bookmark->query</code> <code>$row</code> </MixedAssignment> - <MixedInferredReturnType occurrences="3"> + <MixedInferredReturnType occurrences="1"> <code>array|false</code> - <code>bool</code> - <code>bool</code> </MixedInferredReturnType> <MixedOperand occurrences="9"> <code>Util::backquote($cfgBookmark['db'])</code> @@ -112,9 +110,7 @@ <code>Util::backquote($cfgBookmark['table'])</code> <code>Util::backquote($id_field)</code> </MixedOperand> - <MixedReturnStatement occurrences="3"> - <code>$this->dbi->query($query, DatabaseInterface::CONNECT_CONTROL)</code> - <code>$this->dbi->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)</code> + <MixedReturnStatement occurrences="1"> <code>Cache::get($cacheKey)</code> </MixedReturnStatement> <PropertyNotSetInConstructor occurrences="5"> @@ -534,19 +530,14 @@ <code>$val</code> <code>$value</code> </MixedAssignment> - <MixedInferredReturnType occurrences="3"> + <MixedInferredReturnType occurrences="2"> <code>?string</code> - <code>bool</code> <code>string</code> </MixedInferredReturnType> - <MixedReturnStatement occurrences="3"> + <MixedReturnStatement occurrences="2"> <code>$cookie_path</code> <code>$temp_dir[$name]</code> - <code>$this->get('is_https')</code> </MixedReturnStatement> - <NullableReturnStatement occurrences="1"> - <code>$this->get('is_https')</code> - </NullableReturnStatement> <PossiblyInvalidArgument occurrences="2"> <code>$default_value</code> <code>$request</code> @@ -6424,14 +6415,10 @@ <code>$value</code> <code>$warningsCount</code> </MixedAssignment> - <MixedInferredReturnType occurrences="10"> + <MixedInferredReturnType occurrences="6"> <code>array</code> <code>array</code> <code>array</code> - <code>bool</code> - <code>bool</code> - <code>bool</code> - <code>bool</code> <code>int|false</code> <code>string</code> <code>string|bool</code> @@ -6467,17 +6454,13 @@ <MixedPropertyFetch occurrences="1"> <code>$this->links[$link]->warning_count</code> </MixedPropertyFetch> - <MixedReturnStatement occurrences="12"> + <MixedReturnStatement occurrences="8"> <code>$column != null ? array_shift($fields) : $fields</code> <code>$tables[$database]</code> <code>$tables[mb_strtolower($database)]</code> <code>$this->fetchValue('SELECT LAST_INSERT_ID();', 0, 0, $link)</code> <code>$this->lowerCaseTableNames</code> - <code>$this->query('SET ' . $var . ' = ' . $value . ';', $link)</code> <code>$user</code> - <code>SessionCache::get('is_createuser')</code> - <code>SessionCache::get('is_grantuser')</code> - <code>SessionCache::get('is_superuser')</code> <code>SessionCache::get('mysql_cur_user')</code> <code>reset($columns)</code> </MixedReturnStatement> @@ -6485,10 +6468,7 @@ <code>$this->extension->realMultiQuery($this->links[$linkIndex], $multiQuery)</code> <code>mysqli_result[]|bool</code> </MixedReturnTypeCoercion> - <NullableReturnStatement occurrences="4"> - <code>SessionCache::get('is_createuser')</code> - <code>SessionCache::get('is_grantuser')</code> - <code>SessionCache::get('is_superuser')</code> + <NullableReturnStatement occurrences="1"> <code>SessionCache::get('mysql_cur_user')</code> </NullableReturnStatement> <PossiblyInvalidArgument occurrences="1"> @@ -8357,9 +8337,8 @@ <code>$position</code> <code>$start</code> </MixedAssignment> - <MixedInferredReturnType occurrences="3"> + <MixedInferredReturnType occurrences="2"> <code>?int</code> - <code>bool</code> <code>stdClass|null</code> </MixedInferredReturnType> <MixedOperand occurrences="9"> @@ -8381,8 +8360,7 @@ <code>$commit_json->committer->email</code> <code>$commit_json->committer->name</code> </MixedPropertyFetch> - <MixedReturnStatement occurrences="3"> - <code>$_SESSION['is_git_revision']</code> + <MixedReturnStatement occurrences="2"> <code>$packOffsets[1]</code> <code>json_decode((string) $is_found)</code> </MixedReturnStatement> @@ -9237,16 +9215,6 @@ <code>is_array($rules)</code> </TypeDoesNotContainType> </file> - <file src="libraries/classes/Language.php"> - <InvalidReturnStatement occurrences="2"> - <code>preg_match($pattern, $header)</code> - <code>preg_match($pattern, $header)</code> - </InvalidReturnStatement> - <InvalidReturnType occurrences="2"> - <code>bool</code> - <code>bool</code> - </InvalidReturnType> - </file> <file src="libraries/classes/LanguageManager.php"> <DocblockTypeContradiction occurrences="1"> <code>self::$instance === null</code> @@ -10673,10 +10641,6 @@ <DocblockTypeContradiction occurrences="1"> <code>$resp == null</code> </DocblockTypeContradiction> - <ImplementedReturnTypeMismatch occurrences="2"> - <code>bool|void</code> - <code>void|bool</code> - </ImplementedReturnTypeMismatch> <InvalidScalarArgument occurrences="1"> <code>Core::getIp()</code> </InvalidScalarArgument> @@ -13549,10 +13513,6 @@ </InvalidArgument> </file> <file src="libraries/classes/Plugins/TwoFactor/Application.php"> - <InvalidReturnStatement occurrences="1"/> - <InvalidReturnType occurrences="1"> - <code>bool</code> - </InvalidReturnType> <MixedArgument occurrences="3"> <code>$_POST['2fa_code']</code> <code>$secret</code> @@ -13618,19 +13578,10 @@ <DocblockTypeContradiction occurrences="1"> <code>is_array($result)</code> </DocblockTypeContradiction> - <MixedInferredReturnType occurrences="1"> - <code>bool</code> - </MixedInferredReturnType> - <MixedReturnStatement occurrences="1"> - <code>SessionCache::get('profiling_supported')</code> - </MixedReturnStatement> <MixedReturnTypeCoercion occurrences="2"> <code>$result</code> <code>array<string, string>|null</code> </MixedReturnTypeCoercion> - <NullableReturnStatement occurrences="1"> - <code>SessionCache::get('profiling_supported')</code> - </NullableReturnStatement> </file> <file src="libraries/classes/Properties/Options/OptionsPropertyGroup.php"> <DocblockTypeContradiction occurrences="1"> @@ -14043,9 +13994,8 @@ <code>$value</code> <code>$value</code> </MixedAssignment> - <MixedInferredReturnType occurrences="5"> + <MixedInferredReturnType occurrences="4"> <code>array|false</code> - <code>bool</code> <code>string</code> <code>string[]</code> <code>string|false</code> @@ -14103,13 +14053,12 @@ <code>Util::backquote($foreign_table)</code> <code>Util::backquote($tableDbName)</code> </MixedOperand> - <MixedReturnStatement occurrences="6"> + <MixedReturnStatement occurrences="5"> <code>$_SESSION['relation'][$GLOBALS['server']]</code> <code>$column['COLUMN_NAME']</code> <code>$comment</code> <code>$foreigners[$column]</code> <code>$row['display_field']</code> - <code>$this->queryAsControlUser($upd_query)</code> </MixedReturnStatement> <MixedReturnTypeCoercion occurrences="2"> <code>$cfgRelation</code> @@ -15713,9 +15662,8 @@ <code>$this->comment</code> <code>$this->title</code> </MixedAssignment> - <MixedInferredReturnType occurrences="3"> + <MixedInferredReturnType occurrences="2"> <code>array[]</code> - <code>bool</code> <code>string</code> </MixedInferredReturnType> <MixedOperand occurrences="4"> @@ -15724,10 +15672,9 @@ <code>$parsed_size[0]</code> <code>$parsed_size[1]</code> </MixedOperand> - <MixedReturnStatement occurrences="3"> + <MixedReturnStatement occurrences="2"> <code>$storage_engines</code> <code>$this->$id()</code> - <code>Cache::get($cacheKey, false)</code> </MixedReturnStatement> <MixedReturnTypeCoercion occurrences="2"> <code>[$dataLength, $indexLength]</code> @@ -16744,10 +16691,8 @@ <code>$test_rs</code> <code>$values</code> </MixedAssignment> - <MixedInferredReturnType occurrences="3"> + <MixedInferredReturnType occurrences="1"> <code>array</code> - <code>bool</code> - <code>bool</code> </MixedInferredReturnType> <MixedOperand occurrences="12"> <code>Util::backquote($cfgRelation['column_info'])</code> @@ -16763,9 +16708,7 @@ <code>Util::backquote($cfgRelation['db'])</code> <code>Util::backquote($cfgRelation['db'])</code> </MixedOperand> - <MixedReturnStatement occurrences="3"> - <code>$dbi->tryQuery($delete_sql)</code> - <code>$relation->queryAsControlUser($upd_query)</code> + <MixedReturnStatement occurrences="1"> <code>$stack</code> </MixedReturnStatement> <PossiblyNullArgument occurrences="1"> @@ -16796,9 +16739,8 @@ <code>$result</code> <code>$result['type']</code> </MixedAssignment> - <MixedInferredReturnType occurrences="2"> + <MixedInferredReturnType occurrences="1"> <code>array</code> - <code>bool</code> </MixedInferredReturnType> <MixedMethodCall occurrences="6"> <code>$cls::getDescription()</code> @@ -16808,8 +16750,7 @@ <code>new $cls($this)</code> <code>new $name($this)</code> </MixedMethodCall> - <MixedReturnStatement occurrences="2"> - <code>$_SESSION['two_factor_check']</code> + <MixedReturnStatement occurrences="1"> <code>$result</code> </MixedReturnStatement> <MoreSpecificReturnType occurrences="1"> diff --git a/test/classes/Stubs/DbiDummy.php b/test/classes/Stubs/DbiDummy.php index 991f20665f..1db41249d5 100644 --- a/test/classes/Stubs/DbiDummy.php +++ b/test/classes/Stubs/DbiDummy.php @@ -116,10 +116,8 @@ class DbiDummy implements DbiExtension * * @param string|DatabaseName $databaseName name of db to select * @param object $link mysql link resource - * - * @return bool */ - public function selectDb($databaseName, $link) + public function selectDb($databaseName, $link): bool { $databaseName = $databaseName instanceof DatabaseName ? $databaseName->getName() : $databaseName; @@ -326,10 +324,8 @@ class DbiDummy implements DbiExtension * * @param object $result database result * @param int $offset offset to seek - * - * @return bool true on success, false on failure */ - public function dataSeek($result, $offset) + public function dataSeek($result, $offset): bool { $query_data = &$this->getQueryData($result); if ($offset > count($query_data['result'])) { @@ -354,10 +350,8 @@ class DbiDummy implements DbiExtension * Check if there are any more query results from a multi query * * @param object $link the connection object - * - * @return bool false */ - public function moreResults($link) + public function moreResults($link): bool { return false; } @@ -366,10 +360,8 @@ class DbiDummy implements DbiExtension * Prepare next result from multi_query * * @param object $link the connection object - * - * @return bool false */ - public function nextResult($link) + public function nextResult($link): bool { return false; } diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index 7faac435e4..c36e93a8d7 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -730,8 +730,6 @@ abstract class TestBase extends TestCase /** * Check if user is logged in to phpmyadmin - * - * @return bool Where or not user is logged in */ public function isLoggedIn(): bool { @@ -816,8 +814,6 @@ abstract class TestBase extends TestCase * * @param string $func Locate using - cssSelector, xpath, tagName, partialLinkText, linkText, name, id, className * @param string $arg Selector - * - * @return bool Whether or not the element is present */ public function isElementPresent(string $func, string $arg): bool { |