diff options
author | MaurĂcio Meneghini Fauth <mauricio@fauth.dev> | 2021-09-14 17:10:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 17:10:40 +0300 |
commit | f3c5b867ee8d6339ee5fc96826364789a7088dad (patch) | |
tree | c25e3b3f63bb6efb1d9e9931c2f600c2a22e0fc3 | |
parent | 974ef81d26d41f758a1d1b8a139533b86af43779 (diff) | |
parent | 7f6472b2c2e4a075da7e6755e13c17f0b12f1619 (diff) |
Merge pull request #17107 from mauriciofauth/void-return-type
Add `void` return type where possible
101 files changed, 312 insertions, 905 deletions
diff --git a/examples/openid.php b/examples/openid.php index f7d57c9c59..baff0e452a 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -37,10 +37,8 @@ $AUTH_MAP = [ * Simple function to show HTML page with given content. * * @param string $contents Content to include in page - * - * @return void */ -function Show_page($contents) +function Show_page($contents): void { header('Content-Type: text/html; charset=utf-8'); @@ -68,10 +66,8 @@ function Show_page($contents) * Display error and exit * * @param Exception $e Exception object - * - * @return void */ -function Die_error($e) +function Die_error($e): void { $contents = "<div class='relyingparty_results'>\n"; $contents .= '<pre>' . htmlspecialchars($e->getMessage()) . "</pre>\n"; diff --git a/js/messages.php b/js/messages.php index 318facc6cd..36cadc1a24 100644 --- a/js/messages.php +++ b/js/messages.php @@ -58,7 +58,7 @@ Common::run(); $buffer = OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function(static function () { +register_shutdown_function(static function (): void { echo OutputBuffering::getInstance()->getContents(); }); diff --git a/libraries/classes/Advisor.php b/libraries/classes/Advisor.php index c402908bad..e6cc3e939b 100644 --- a/libraries/classes/Advisor.php +++ b/libraries/classes/Advisor.php @@ -61,7 +61,7 @@ class Advisor */ $this->expression->register( 'round', - static function () { + static function (): void { }, /** * @param array $arguments @@ -73,7 +73,7 @@ class Advisor ); $this->expression->register( 'substr', - static function () { + static function (): void { }, /** * @param array $arguments @@ -87,7 +87,7 @@ class Advisor ); $this->expression->register( 'preg_match', - static function () { + static function (): void { }, /** * @param array $arguments @@ -100,7 +100,7 @@ class Advisor ); $this->expression->register( 'ADVISOR_bytime', - static function () { + static function (): void { }, /** * @param array $arguments @@ -113,7 +113,7 @@ class Advisor ); $this->expression->register( 'ADVISOR_timespanFormat', - static function () { + static function (): void { }, /** * @param array $arguments @@ -125,7 +125,7 @@ class Advisor ); $this->expression->register( 'ADVISOR_formatByteDown', - static function () { + static function (): void { }, /** * @param array $arguments @@ -139,7 +139,7 @@ class Advisor ); $this->expression->register( 'fired', - static function () { + static function (): void { }, /** * @param array $arguments diff --git a/libraries/classes/Command/TwigLintCommand.php b/libraries/classes/Command/TwigLintCommand.php index 07742a2ec7..876d352376 100644 --- a/libraries/classes/Command/TwigLintCommand.php +++ b/libraries/classes/Command/TwigLintCommand.php @@ -66,10 +66,7 @@ class TwigLintCommand extends Command /** @var string|null */ protected static $defaultDescription = 'Lint a Twig template and outputs encountered errors'; - /** - * @return void - */ - protected function configure() + protected function configure(): void { $this ->setDescription((string) self::$defaultDescription) diff --git a/libraries/classes/Config/ConfigFile.php b/libraries/classes/Config/ConfigFile.php index 70ea3c702a..7577a27bf2 100644 --- a/libraries/classes/Config/ConfigFile.php +++ b/libraries/classes/Config/ConfigFile.php @@ -124,10 +124,8 @@ class ConfigFile * they are set to their default values (use only full paths) * * @param array $keys the names of the config options - * - * @return void */ - public function setPersistKeys(array $keys) + public function setPersistKeys(array $keys): void { // checking key presence is much faster than searching so move values // to keys @@ -149,10 +147,8 @@ class ConfigFile * this method to set up a filter on {@link set()} method * * @param array|null $keys array of allowed keys or null to remove filter - * - * @return void */ - public function setAllowedKeys($keys) + public function setAllowedKeys($keys): void { if ($keys === null) { $this->setFilter = null; @@ -172,20 +168,16 @@ class ConfigFile * * @param array $mapping Contains the mapping of "Server/config options" * to "Server/1/config options" - * - * @return void */ - public function setCfgUpdateReadMapping(array $mapping) + public function setCfgUpdateReadMapping(array $mapping): void { $this->cfgUpdateReadMapping = $mapping; } /** * Resets configuration data - * - * @return void */ - public function resetConfigData() + public function resetConfigData(): void { $_SESSION[$this->id] = []; } @@ -194,10 +186,8 @@ class ConfigFile * Sets configuration data (overrides old data) * * @param array $cfg Configuration options - * - * @return void */ - public function setConfigData(array $cfg) + public function setConfigData(array $cfg): void { $_SESSION[$this->id] = $cfg; } @@ -208,10 +198,8 @@ class ConfigFile * @param string $path Path * @param mixed $value Value * @param string $canonicalPath Canonical path - * - * @return void */ - public function set($path, $value, $canonicalPath = null) + public function set($path, $value, $canonicalPath = null): void { if ($canonicalPath === null) { $canonicalPath = $this->getCanonicalPath($path); @@ -268,17 +256,15 @@ class ConfigFile * @param mixed $value Value * @param mixed $key Key * @param mixed $prefix Prefix - * - * @return void */ - private function flattenArray($value, $key, $prefix) + private function flattenArray($value, $key, $prefix): void { // no recursion for numeric arrays if (is_array($value) && ! isset($value[0])) { $prefix .= $key . '/'; array_walk( $value, - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->flattenArray($value, $key, $prefix); }, $prefix @@ -298,7 +284,7 @@ class ConfigFile $this->flattenArrayResult = []; array_walk( $this->defaultCfg, - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->flattenArray($value, $key, $prefix); }, '' @@ -314,16 +300,14 @@ class ConfigFile * (config will contain differences to defaults from config.defaults.php). * * @param array $cfg Configuration - * - * @return void */ - public function updateWithGlobalConfig(array $cfg) + public function updateWithGlobalConfig(array $cfg): void { // load config array and flatten it $this->flattenArrayResult = []; array_walk( $cfg, - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->flattenArray($value, $key, $prefix); }, '' @@ -503,10 +487,8 @@ class ConfigFile * Removes server * * @param int $server server index - * - * @return void */ - public function removeServer($server) + public function removeServer($server): void { if (! isset($_SESSION[$this->id]['Servers'][$server])) { return; @@ -561,7 +543,7 @@ class ConfigFile $this->flattenArrayResult = []; array_walk( $_SESSION[$this->id], - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->flattenArray($value, $key, $prefix); }, '' diff --git a/libraries/classes/Config/Form.php b/libraries/classes/Config/Form.php index a4af57e7a6..aa01acb3bb 100644 --- a/libraries/classes/Config/Form.php +++ b/libraries/classes/Config/Form.php @@ -178,16 +178,14 @@ class Form * @param mixed $value Value * @param mixed $key Key * @param mixed $prefix Prefix - * - * @return void */ - private function readFormPathsCallback($value, $key, $prefix) + private function readFormPathsCallback($value, $key, $prefix): void { if (is_array($value)) { $prefix .= $key . '/'; array_walk( $value, - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->readFormPathsCallback($value, $key, $prefix); }, $prefix @@ -221,16 +219,14 @@ class Form * Reads form paths to {@link $fields} * * @param array $form Form - * - * @return void */ - protected function readFormPaths(array $form) + protected function readFormPaths(array $form): void { // flatten form fields' paths and save them to $fields $this->fields = []; array_walk( $form, - function ($value, $key, $prefix) { + function ($value, $key, $prefix): void { $this->readFormPathsCallback($value, $key, $prefix); }, '' @@ -252,10 +248,8 @@ class Form /** * Reads fields' types to $this->fieldsTypes - * - * @return void */ - protected function readTypes() + protected function readTypes(): void { $cf = $this->configFile; foreach ($this->fields as $name => $path) { @@ -307,10 +301,8 @@ class Form * * @param string $formName Form name * @param array $form Form - * - * @return void */ - public function loadForm($formName, array $form) + public function loadForm($formName, array $form): void { $this->name = $formName; $form = $this->cleanGroupPaths($form); diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index f6a8391de5..e00f687a6f 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -135,10 +135,8 @@ class FormDisplay * @param string $formName Form name * @param array $form Form data * @param int $serverId 0 if new server, validation; >= 1 if editing a server - * - * @return void */ - public function registerForm($formName, array $form, $serverId = null) + public function registerForm($formName, array $form, $serverId = null): void { $this->forms[$formName] = new Form( $formName, @@ -181,10 +179,8 @@ class FormDisplay /** * Runs validation for all registered forms - * - * @return void */ - private function validate() + private function validate(): void { if ($this->isValidated) { return; @@ -524,10 +520,8 @@ class FormDisplay /** * Reverts erroneous fields to their default values - * - * @return void */ - public function fixErrors() + public function fixErrors(): void { $this->validate(); if (count($this->errors) === 0) { @@ -804,10 +798,8 @@ class FormDisplay /** * Fills out {@link userprefs_keys} and {@link userprefs_disallow} - * - * @return void */ - private function loadUserprefsInfo() + private function loadUserprefsInfo(): void { if ($this->userprefsKeys !== null) { return; @@ -826,10 +818,8 @@ class FormDisplay * * @param string $systemPath Path to settings * @param array $opts Chosen options - * - * @return void */ - private function setComments($systemPath, array &$opts) + private function setComments($systemPath, array &$opts): void { // RecodingEngine - mark unavailable types if ($systemPath === 'RecodingEngine') { @@ -922,10 +912,8 @@ class FormDisplay * * @param array $postValues List of parameters * @param string $key Array key - * - * @return void */ - private function fillPostArrayParameters(array $postValues, $key) + private function fillPostArrayParameters(array $postValues, $key): void { foreach ($postValues as $v) { $v = Util::requestString($v); diff --git a/libraries/classes/Config/Forms/BaseFormList.php b/libraries/classes/Config/Forms/BaseFormList.php index 681a7abd5b..131adef238 100644 --- a/libraries/classes/Config/Forms/BaseFormList.php +++ b/libraries/classes/Config/Forms/BaseFormList.php @@ -116,10 +116,8 @@ class BaseFormList /** * Reverts erroneous fields to their default values - * - * @return void */ - public function fixErrors() + public function fixErrors(): void { foreach ($this->forms as $form) { $form->fixErrors(); diff --git a/libraries/classes/Config/PageSettings.php b/libraries/classes/Config/PageSettings.php index c86fb95779..9c7bfa6065 100644 --- a/libraries/classes/Config/PageSettings.php +++ b/libraries/classes/Config/PageSettings.php @@ -98,10 +98,8 @@ class PageSettings * @param FormDisplay $formDisplay Form * @param ConfigFile $cf Configuration file * @param Message|null $error Error message - * - * @return void */ - private function processPageSettings(&$formDisplay, &$cf, &$error) + private function processPageSettings(&$formDisplay, &$cf, &$error): void { if (! $formDisplay->process(false) || $formDisplay->hasErrors()) { return; @@ -126,10 +124,8 @@ class PageSettings * * @param FormDisplay $formDisplay Form * @param Message|null $error Error message - * - * @return void */ - private function storeError(&$formDisplay, &$error) + private function storeError(&$formDisplay, &$error): void { $retval = ''; if ($error) { diff --git a/libraries/classes/Config/ServerConfigChecks.php b/libraries/classes/Config/ServerConfigChecks.php index c403de1003..416ae1a2a4 100644 --- a/libraries/classes/Config/ServerConfigChecks.php +++ b/libraries/classes/Config/ServerConfigChecks.php @@ -44,10 +44,8 @@ class ServerConfigChecks /** * Perform config checks - * - * @return void */ - public function performConfigChecks() + public function performConfigChecks(): void { $blowfishSecret = $this->cfg->get('blowfish_secret'); $blowfishSecretSet = false; @@ -286,10 +284,8 @@ class ServerConfigChecks /** * Perform config checks for zip part. - * - * @return void */ - protected function performConfigChecksZips() + protected function performConfigChecksZips(): void { $this->performConfigChecksServerGZipdump(); $this->performConfigChecksServerBZipdump(); @@ -298,10 +294,8 @@ class ServerConfigChecks /** * Perform config checks for zip part. - * - * @return void */ - protected function performConfigChecksServersZipdump() + protected function performConfigChecksServersZipdump(): void { // $cfg['ZipDump'] // requires zip_open in import @@ -415,10 +409,8 @@ class ServerConfigChecks /** * Check configuration for login cookie - * - * @return void */ - protected function performConfigChecksLoginCookie() + protected function performConfigChecksLoginCookie(): void { // $cfg['LoginCookieValidity'] // value greater than session.gc_maxlifetime will cause @@ -495,10 +487,8 @@ class ServerConfigChecks /** * Check GZipDump configuration - * - * @return void */ - protected function performConfigChecksServerBZipdump() + protected function performConfigChecksServerBZipdump(): void { // $cfg['BZipDump'] // requires bzip2 functions @@ -535,10 +525,8 @@ class ServerConfigChecks /** * Check GZipDump configuration - * - * @return void */ - protected function performConfigChecksServerGZipdump() + protected function performConfigChecksServerGZipdump(): void { // $cfg['GZipDump'] // requires zlib functions diff --git a/libraries/classes/Controllers/Table/FindReplaceController.php b/libraries/classes/Controllers/Table/FindReplaceController.php index 7ab45a97c5..6419a328d9 100644 --- a/libraries/classes/Controllers/Table/FindReplaceController.php +++ b/libraries/classes/Controllers/Table/FindReplaceController.php @@ -340,8 +340,6 @@ class FindReplaceController extends AbstractController * @param string $replaceWith string to replace with * @param bool $useRegex to use Regex replace or not * @param string $charSet character set of the connection - * - * @return void */ public function replace( $columnIndex, @@ -349,7 +347,7 @@ class FindReplaceController extends AbstractController $replaceWith, $useRegex, $charSet - ) { + ): void { $column = $this->columnNames[$columnIndex]; if ($useRegex) { $toReplace = $this->getRegexReplaceRows( diff --git a/libraries/classes/Controllers/Table/SearchController.php b/libraries/classes/Controllers/Table/SearchController.php index 800d0f7965..343e958403 100644 --- a/libraries/classes/Controllers/Table/SearchController.php +++ b/libraries/classes/Controllers/Table/SearchController.php @@ -228,10 +228,8 @@ class SearchController extends AbstractController /** * Get data row action - * - * @return void */ - public function getDataRowAction() + public function getDataRowAction(): void { if (! Core::checkSqlQuerySignature($_POST['where_clause'], $_POST['where_clause_sign'])) { return; @@ -268,10 +266,8 @@ class SearchController extends AbstractController /** * Do selection action - * - * @return void */ - public function doSelectionAction() + public function doSelectionAction(): void { /** * Selection criteria have been submitted -> do the work @@ -338,10 +334,8 @@ class SearchController extends AbstractController /** * Range search action - * - * @return void */ - public function rangeSearchAction() + public function rangeSearchAction(): void { $min_max = $this->getColumnMinMax($_POST['column']); $this->response->addJSON('column_data', $min_max); diff --git a/libraries/classes/Controllers/Table/Structure/BrowseController.php b/libraries/classes/Controllers/Table/Structure/BrowseController.php index 558d5e88d0..c9c5dbe3d5 100644 --- a/libraries/classes/Controllers/Table/Structure/BrowseController.php +++ b/libraries/classes/Controllers/Table/Structure/BrowseController.php @@ -43,10 +43,8 @@ final class BrowseController extends AbstractController * Function to display table browse for selected columns * * @param string $goto goto page url - * - * @return void */ - private function displayTableBrowseForSelectedColumns($goto) + private function displayTableBrowseForSelectedColumns($goto): void { $GLOBALS['active_page'] = Url::getFromRoute('/sql'); $fields = []; diff --git a/libraries/classes/Controllers/Table/ZoomSearchController.php b/libraries/classes/Controllers/Table/ZoomSearchController.php index 701996769e..0687306500 100644 --- a/libraries/classes/Controllers/Table/ZoomSearchController.php +++ b/libraries/classes/Controllers/Table/ZoomSearchController.php @@ -241,10 +241,8 @@ class ZoomSearchController extends AbstractController * Display selection form action * * @param string $dataLabel Data label - * - * @return void */ - public function displaySelectionFormAction($dataLabel = null) + public function displaySelectionFormAction($dataLabel = null): void { global $goto; @@ -289,10 +287,8 @@ class ZoomSearchController extends AbstractController /** * Get data row action - * - * @return void */ - public function getDataRowAction() + public function getDataRowAction(): void { if (! Core::checkSqlQuerySignature($_POST['where_clause'], $_POST['where_clause_sign'])) { return; @@ -329,10 +325,8 @@ class ZoomSearchController extends AbstractController /** * Change table info action - * - * @return void */ - public function changeTableInfoAction() + public function changeTableInfoAction(): void { $field = $_POST['field']; if ($field === 'pma_null') { @@ -363,10 +357,8 @@ class ZoomSearchController extends AbstractController * * @param string $dataLabel Data label * @param string $goto Goto - * - * @return void */ - public function zoomSubmitAction($dataLabel, $goto) + public function zoomSubmitAction($dataLabel, $goto): void { //Query generation part $sql_query = $this->search->buildSqlQuery(); diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 4f729c6cf8..e0cfbf3c37 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -775,7 +775,7 @@ class Core /** * @param mixed $item */ - static function ($item) use (&$empty) { + static function ($item) use (&$empty): void { $empty = $empty && empty($item); } ); diff --git a/libraries/classes/Database/Events.php b/libraries/classes/Database/Events.php index 7aaad6f895..f5158b1cd4 100644 --- a/libraries/classes/Database/Events.php +++ b/libraries/classes/Database/Events.php @@ -79,10 +79,8 @@ class Events /** * Handles editor requests for adding or editing an item - * - * @return void */ - public function handleEditor() + public function handleEditor(): void { global $db, $table, $errors, $message; @@ -538,10 +536,8 @@ class Events * @param string $title Title of the editor * @param string $db Database * @param string $operation Operation 'change' or '' - * - * @return void */ - private function sendEditor($mode, ?array $item, $title, $db, $operation) + private function sendEditor($mode, ?array $item, $title, $db, $operation): void { if ($item !== null) { $editor = $this->getEditorForm($mode, $operation, $item); diff --git a/libraries/classes/Database/Qbe.php b/libraries/classes/Database/Qbe.php index 920bac39c7..f2a3ad7702 100644 --- a/libraries/classes/Database/Qbe.php +++ b/libraries/classes/Database/Qbe.php @@ -305,10 +305,8 @@ class Qbe /** * Sets search parameters - * - * @return void */ - private function setSearchParams() + private function setSearchParams(): void { $criteriaColumnCount = $this->initializeCriteriasCount(); @@ -338,10 +336,8 @@ class Qbe /** * Sets criteria tables and columns - * - * @return void */ - private function setCriteriaTablesAndColumns() + private function setCriteriaTablesAndColumns(): void { // The tables list sent by a previously submitted form if (isset($_POST['TableList']) && is_array($_POST['TableList'])) { @@ -1635,10 +1631,8 @@ class Qbe * * @param array $relations array of relations * @param string $oneTable the table - * - * @return void */ - private function loadRelationsForTable(array &$relations, $oneTable) + private function loadRelationsForTable(array &$relations, $oneTable): void { $relations[$oneTable] = []; @@ -1674,10 +1668,8 @@ class Qbe * @param array $finalized JOIN clauses for each table * @param array $relations Relations among tables * @param array $searchTables Tables involved in the search - * - * @return void */ - private function fillJoinClauses(array &$finalized, array $relations, array $searchTables) + private function fillJoinClauses(array &$finalized, array $relations, array $searchTables): void { while (true) { $added = false; diff --git a/libraries/classes/Database/Routines.php b/libraries/classes/Database/Routines.php index 737d2c6f66..0c4f69d262 100644 --- a/libraries/classes/Database/Routines.php +++ b/libraries/classes/Database/Routines.php @@ -77,10 +77,8 @@ class Routines /** * Handles editor requests for adding or editing an item - * - * @return void */ - public function handleEditor() + public function handleEditor(): void { global $db, $errors; @@ -1388,10 +1386,8 @@ class Routines /** * Handles requests for executing a routine - * - * @return void */ - public function handleExecute() + public function handleExecute(): void { global $db; diff --git a/libraries/classes/Database/Search.php b/libraries/classes/Database/Search.php index 864d73a27d..2dd04b7f62 100644 --- a/libraries/classes/Database/Search.php +++ b/libraries/classes/Database/Search.php @@ -121,10 +121,8 @@ class Search /** * Sets search parameters - * - * @return void */ - private function setSearchParams() + private function setSearchParams(): void { $this->tablesNamesOnly = $this->dbi->getTables($this->db); diff --git a/libraries/classes/Database/Triggers.php b/libraries/classes/Database/Triggers.php index 08e7c06158..ac83eaf8f2 100644 --- a/libraries/classes/Database/Triggers.php +++ b/libraries/classes/Database/Triggers.php @@ -55,10 +55,8 @@ class Triggers /** * Main function for the triggers functionality - * - * @return void */ - public function main() + public function main(): void { global $db, $table; @@ -95,10 +93,8 @@ class Triggers /** * Handles editor requests for adding or editing an item - * - * @return void */ - public function handleEditor() + public function handleEditor(): void { global $db, $errors, $message, $table; @@ -473,10 +469,8 @@ class Triggers * @param array|null $item Data necessary to create the editor * @param string $title Title of the editor * @param string $db Database - * - * @return void */ - private function sendEditor($mode, ?array $item, $title, $db) + private function sendEditor($mode, ?array $item, $title, $db): void { global $db, $table; diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 7ab8bf3602..a030afe09e 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -1189,10 +1189,8 @@ class DatabaseInterface implements DbalInterface /** * This function checks and initializes the phpMyAdmin configuration * storage state before it is used into session cache. - * - * @return void */ - public function initRelationParamsCache() + public function initRelationParamsCache(): void { if (strlen($GLOBALS['db'])) { $cfgRelation = $this->relation->getRelationsParam(); diff --git a/libraries/classes/Dbal/DbiExtension.php b/libraries/classes/Dbal/DbiExtension.php index d94c4b3e79..9ed06fccbf 100644 --- a/libraries/classes/Dbal/DbiExtension.php +++ b/libraries/classes/Dbal/DbiExtension.php @@ -95,10 +95,8 @@ interface DbiExtension * Frees memory associated with the result * * @param object $result database result - * - * @return void */ - public function freeResult($result); + public function freeResult($result): void; /** * Check if there are any more query results from a multi query diff --git a/libraries/classes/Dbal/DbiMysqli.php b/libraries/classes/Dbal/DbiMysqli.php index 734f6a09ec..6308df2122 100644 --- a/libraries/classes/Dbal/DbiMysqli.php +++ b/libraries/classes/Dbal/DbiMysqli.php @@ -270,10 +270,8 @@ class DbiMysqli implements DbiExtension * Frees memory associated with the result * * @param mysqli_result $result database result - * - * @return void */ - public function freeResult($result) + public function freeResult($result): void { if (! ($result instanceof mysqli_result)) { return; diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 6002a81789..b545ca306c 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -271,10 +271,8 @@ class Results /** * Sets default transformations for some columns - * - * @return void */ - private function setDefaultTransformations() + private function setDefaultTransformations(): void { $jsonHighlightingData = [ 'libraries/classes/Plugins/Transformations/Output/Text_Plain_Json.php', @@ -400,8 +398,6 @@ class Results * @param bool $isBrowseDistinct whether browsing distinct values * @psalm-param int|numeric-string $unlimNumRows * @psalm-param int|numeric-string $numRows - * - * @return void */ public function setProperties( $unlimNumRows, @@ -421,7 +417,7 @@ class Results $printView, $editable, $isBrowseDistinct - ) { + ): void { $this->properties['unlim_num_rows'] = $unlimNumRows; $this->properties['fields_meta'] = $fieldsMeta; $this->properties['is_count'] = $isCount; @@ -1462,11 +1458,9 @@ class Results * * @param array $analyzedSqlResults analyzed sql results * - * @return void - * * @access private */ - private function setHighlightedColumnGlobalField(array $analyzedSqlResults) + private function setHighlightedColumnGlobalField(array $analyzedSqlResults): void { $highlightColumns = []; @@ -2099,10 +2093,8 @@ class Results * * @param FieldMetadata $fieldsMeta set of field properties * @param array $thClass array containing classes - * - * @return void */ - private function getClassForNumericColumnType(FieldMetadata $fieldsMeta, array &$thClass) + private function getClassForNumericColumnType(FieldMetadata $fieldsMeta, array &$thClass): void { // This was defined in commit b661cd7c9b31f8bc564d2f9a1b8527e0eb966de8 // For issue https://github.com/phpmyadmin/phpmyadmin/issues/4746 @@ -2620,10 +2612,8 @@ class Results /** * Sets the MIME details of the columns in the results set - * - * @return void */ - private function setMimeMap() + private function setMimeMap(): void { /** @var FieldMetadata[] $fieldsMeta */ $fieldsMeta = $this->properties['fields_meta']; @@ -3783,15 +3773,13 @@ class Results * Checks the posted options for viewing query results * and sets appropriate values in the session. * - * @return void - * * @todo make maximum remembered queries configurable * @todo move/split into SQL class!? * @todo currently this is called twice unnecessary * @todo ignore LIMIT and ORDER in query!? * @access public */ - public function setConfigParamsForDisplayTable() + public function setConfigParamsForDisplayTable(): void { $sqlMd5 = md5( $this->properties['server'] @@ -4429,11 +4417,9 @@ class Results * * @param array $map the list of relations * - * @return void - * * @access private */ - private function setParamForLinkForeignKeyRelatedTables(array &$map) + private function setParamForLinkForeignKeyRelatedTables(array &$map): void { // To be able to later display a link to the related table, // we verify both types of relations: either those that are diff --git a/libraries/classes/Gis/GisVisualization.php b/libraries/classes/Gis/GisVisualization.php index 7de763b269..43c3ad76cb 100644 --- a/libraries/classes/Gis/GisVisualization.php +++ b/libraries/classes/Gis/GisVisualization.php @@ -178,11 +178,9 @@ class GisVisualization /** * All the variable initialization, options handling has to be done here. * - * @return void - * * @access protected */ - protected function init() + protected function init(): void { $this->handleOptions(); } @@ -279,11 +277,9 @@ class GisVisualization * A function which handles passed parameters. Useful if desired * chart needs to be a little bit different from the default one. * - * @return void - * * @access private */ - private function handleOptions() + private function handleOptions(): void { if ($this->userSpecifiedSettings === null) { return; @@ -328,11 +324,9 @@ class GisVisualization * @param string $type mime type * @param string $ext extension of the file * - * @return void - * * @access private */ - private function writeToFile($file_name, $type, $ext) + private function writeToFile($file_name, $type, $ext): void { $file_name = $this->sanitizeName($file_name, $ext); Core::downloadHeader($file_name, $type); @@ -382,11 +376,9 @@ class GisVisualization * * @param string $file_name File name * - * @return void - * * @access public */ - public function toFileAsSvg($file_name) + public function toFileAsSvg($file_name): void { $img = $this->svg(); $this->writeToFile($file_name, 'image/svg+xml', 'svg'); @@ -514,11 +506,9 @@ class GisVisualization * * @param string $file_name File name * - * @return void - * * @access public */ - public function toFileAsPdf($file_name) + public function toFileAsPdf($file_name): void { $this->init(); @@ -579,10 +569,8 @@ class GisVisualization * * @param string $filename Filename * @param string $format Output format - * - * @return void */ - public function toFile($filename, $format) + public function toFile($filename, $format): void { if ($format === 'svg') { $this->toFileAsSvg($filename); @@ -780,10 +768,8 @@ class GisVisualization * Set user specified settings * * @param array $userSpecifiedSettings User specified settings - * - * @return void */ - public function setUserSpecifiedSettings(array $userSpecifiedSettings) + public function setUserSpecifiedSettings(array $userSpecifiedSettings): void { $this->userSpecifiedSettings = $userSpecifiedSettings; } diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index 5757b6786d..2841cd3cf4 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -259,10 +259,8 @@ class Index * Add column to index * * @param array $params column params - * - * @return void */ - public function addColumn(array $params) + public function addColumn(array $params): void { $key = $params['Column_name'] ?? $params['Expression'] ?? ''; if (isset($params['Expression'])) { @@ -281,10 +279,8 @@ class Index * Adds a list of columns to the index * * @param array $columns array containing details about the columns - * - * @return void */ - public function addColumns(array $columns) + public function addColumns(array $columns): void { $_columns = []; @@ -328,10 +324,8 @@ class Index * Sets index details * * @param array $params index details - * - * @return void */ - public function set(array $params) + public function set(array $params): void { if (isset($params['columns'])) { $this->addColumns($params['columns']); @@ -574,10 +568,8 @@ class Index * Sets the name of the index * * @param string $name index name - * - * @return void */ - public function setName($name) + public function setName($name): void { $this->name = (string) $name; } diff --git a/libraries/classes/IndexColumn.php b/libraries/classes/IndexColumn.php index b98e5c6b7d..0022b90e11 100644 --- a/libraries/classes/IndexColumn.php +++ b/libraries/classes/IndexColumn.php @@ -82,10 +82,8 @@ class IndexColumn * Sets parameters of the index column * * @param array $params an array containing the parameters of the index column - * - * @return void */ - public function set(array $params) + public function set(array $params): void { if (isset($params['Column_name'])) { $this->name = $params['Column_name']; diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index b7d9bead5c..72934ff195 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -1274,10 +1274,8 @@ class InsertEdit * set $_SESSION for edit_next * * @param string $oneWhereClause one where clause from where clauses array - * - * @return void */ - public function setSessionForEditNext($oneWhereClause) + public function setSessionForEditNext($oneWhereClause): void { $localQuery = 'SELECT * FROM ' . Util::backquote($GLOBALS['db']) . '.' . Util::backquote($GLOBALS['table']) . ' WHERE ' @@ -1977,15 +1975,13 @@ class InsertEdit * @param string $table Table name * @param string $columnName Column name * @param array $extraData Extra data for ajax response - * - * @return void */ public function verifyWhetherValueCanBeTruncatedAndAppendExtraData( $db, $table, $columnName, array &$extraData - ) { + ): void { $extraData['isNeedToRecheck'] = false; $sqlForRealValue = 'SELECT ' . Util::backquote($table) . '.' diff --git a/libraries/classes/Language.php b/libraries/classes/Language.php index 89bfd9fde6..cc5e3403a5 100644 --- a/libraries/classes/Language.php +++ b/libraries/classes/Language.php @@ -179,10 +179,8 @@ class Language /** * Activates given translation - * - * @return void */ - public function activate() + public function activate(): void { $GLOBALS['lang'] = $this->code; diff --git a/libraries/classes/LanguageManager.php b/libraries/classes/LanguageManager.php index 6466f847c0..e03fdb75a7 100644 --- a/libraries/classes/LanguageManager.php +++ b/libraries/classes/LanguageManager.php @@ -971,10 +971,8 @@ class LanguageManager /** * Displays warnings about invalid languages. This needs to be postponed * to show messages at time when language is initialized. - * - * @return void */ - public function showWarnings() + public function showWarnings(): void { // now, that we have loaded the language strings we can send the errors if ( diff --git a/libraries/classes/ListAbstract.php b/libraries/classes/ListAbstract.php index f4431c19da..63e101f9d5 100644 --- a/libraries/classes/ListAbstract.php +++ b/libraries/classes/ListAbstract.php @@ -81,8 +81,6 @@ abstract class ListAbstract extends ArrayObject /** * builds up the list - * - * @return void */ - abstract public function build(); + abstract public function build(): void; } diff --git a/libraries/classes/ListDatabase.php b/libraries/classes/ListDatabase.php index 189ca39b02..aa8c12b817 100644 --- a/libraries/classes/ListDatabase.php +++ b/libraries/classes/ListDatabase.php @@ -37,10 +37,8 @@ class ListDatabase extends ListAbstract /** * checks if the configuration wants to hide some databases - * - * @return void */ - protected function checkHideDatabase() + protected function checkHideDatabase(): void { if (empty($GLOBALS['cfg']['Server']['hide_db'])) { return; @@ -110,10 +108,8 @@ class ListDatabase extends ListAbstract /** * builds up the list - * - * @return void */ - public function build() + public function build(): void { if (! $this->checkOnlyDatabase()) { $items = $this->retrieve(); diff --git a/libraries/classes/Logging.php b/libraries/classes/Logging.php index 2e24fcd7c2..b22d9ddd51 100644 --- a/libraries/classes/Logging.php +++ b/libraries/classes/Logging.php @@ -71,10 +71,8 @@ class Logging * * @param string $user user name * @param string $status status message - * - * @return void */ - public static function logUser($user, $status = 'ok') + public static function logUser($user, $status = 'ok'): void { if (function_exists('apache_note')) { apache_note('userID', $user); diff --git a/libraries/classes/Navigation/Navigation.php b/libraries/classes/Navigation/Navigation.php index 8fde42f1e6..6b1ef666f7 100644 --- a/libraries/classes/Navigation/Navigation.php +++ b/libraries/classes/Navigation/Navigation.php @@ -156,15 +156,13 @@ class Navigation * @param string $itemType type of the navigation tree item * @param string $dbName database name * @param string $tableName table name if applicable - * - * @return void */ public function hideNavigationItem( $itemName, $itemType, $dbName, $tableName = null - ) { + ): void { $navTable = Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']); $sqlQuery = 'INSERT INTO ' . $navTable @@ -187,15 +185,13 @@ class Navigation * @param string $itemType type of the navigation tree item * @param string $dbName database name * @param string $tableName table name if applicable - * - * @return void */ public function unhideNavigationItem( $itemName, $itemType, $dbName, $tableName = null - ) { + ): void { $navTable = Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . Util::backquote($GLOBALS['cfgRelation']['navigationhiding']); $sqlQuery = 'DELETE FROM ' . $navTable diff --git a/libraries/classes/Navigation/Nodes/NodeDatabase.php b/libraries/classes/Navigation/Nodes/NodeDatabase.php index 3f6539671d..79cdab9abf 100644 --- a/libraries/classes/Navigation/Nodes/NodeDatabase.php +++ b/libraries/classes/Navigation/Nodes/NodeDatabase.php @@ -731,10 +731,8 @@ class NodeDatabase extends Node * Sets the number of hidden items in this database * * @param int $count hidden item count - * - * @return void */ - public function setHiddenCount($count) + public function setHiddenCount($count): void { $this->hiddenCount = $count; } diff --git a/libraries/classes/Operations.php b/libraries/classes/Operations.php index 1ec228a485..f3f727d26d 100644 --- a/libraries/classes/Operations.php +++ b/libraries/classes/Operations.php @@ -49,10 +49,8 @@ class Operations * the db name * * @param string $db database name - * - * @return void */ - public function runProcedureAndFunctionDefinitions($db) + public function runProcedureAndFunctionDefinitions($db): void { $procedure_names = $this->dbi->getProceduresOrFunctions($db, 'PROCEDURE'); if ($procedure_names) { @@ -99,10 +97,8 @@ class Operations /** * Create database before copy - * - * @return void */ - public function createDbBeforeCopy() + public function createDbBeforeCopy(): void { $local_query = 'CREATE DATABASE IF NOT EXISTS ' . Util::backquote($_POST['newname']); @@ -273,10 +269,8 @@ class Operations * the db name * * @param string $db database name - * - * @return void */ - public function runEventDefinitionsForDb($db) + public function runEventDefinitionsForDb($db): void { $event_names = $this->dbi->fetchResult( 'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' @@ -302,10 +296,8 @@ class Operations * @param array $views views as an array * @param bool $move whether database name is empty or not * @param string $db database name - * - * @return void */ - public function handleTheViews(array $views, $move, $db) + public function handleTheViews(array $views, $move, $db): void { // Add DROP IF EXIST to CREATE VIEW query, to remove stand-in VIEW that was created earlier. foreach ($views as $view) { @@ -331,10 +323,8 @@ class Operations * * @param string $oldDb Database name before renaming * @param string $newname New Database name requested - * - * @return void */ - public function adjustPrivilegesMoveDb($oldDb, $newname) + public function adjustPrivilegesMoveDb($oldDb, $newname): void { if ( ! $GLOBALS['db_priv'] || ! $GLOBALS['table_priv'] @@ -382,10 +372,8 @@ class Operations * * @param string $oldDb Database name before copying * @param string $newname New Database name requested - * - * @return void */ - public function adjustPrivilegesCopyDb($oldDb, $newname) + public function adjustPrivilegesCopyDb($oldDb, $newname): void { if ( ! $GLOBALS['db_priv'] || ! $GLOBALS['table_priv'] @@ -489,10 +477,8 @@ class Operations * Create all accumulated constraints * * @param array $sqlConstratints array of sql constraints for the database - * - * @return void */ - public function createAllAccumulatedConstraints(array $sqlConstratints) + public function createAllAccumulatedConstraints(array $sqlConstratints): void { $this->dbi->selectDb($_POST['newname']); foreach ($sqlConstratints as $one_query) { @@ -507,10 +493,8 @@ class Operations * * @param bool $_error whether table rename/copy or not * @param string $db database name - * - * @return void */ - public function duplicateBookmarks($_error, $db) + public function duplicateBookmarks($_error, $db): void { if ($_error || $db == $_POST['newname']) { return; @@ -856,10 +840,8 @@ class Operations * @param string $oldTable Table name before table renaming/moving table * @param string $newDb Database name after table renaming/ moving table * @param string $newTable Table name after table renaming/moving table - * - * @return void */ - public function adjustPrivilegesRenameOrMoveTable($oldDb, $oldTable, $newDb, $newTable) + public function adjustPrivilegesRenameOrMoveTable($oldDb, $oldTable, $newDb, $newTable): void { if ( ! $GLOBALS['table_priv'] || ! $GLOBALS['col_priv'] @@ -900,10 +882,8 @@ class Operations * @param string $oldTable Table name before table copying * @param string $newDb Database name after table copying * @param string $newTable Table name after table copying - * - * @return void */ - public function adjustPrivilegesCopyTable($oldDb, $oldTable, $newDb, $newTable) + public function adjustPrivilegesCopyTable($oldDb, $oldTable, $newDb, $newTable): void { if ( ! $GLOBALS['table_priv'] || ! $GLOBALS['col_priv'] @@ -965,10 +945,8 @@ class Operations * @param string $db Database name * @param string $table Table name * @param string $tbl_collation Collation Name - * - * @return void */ - public function changeAllColumnsCollation($db, $table, $tbl_collation) + public function changeAllColumnsCollation($db, $table, $tbl_collation): void { $this->dbi->selectDb($db); diff --git a/libraries/classes/OutputBuffering.php b/libraries/classes/OutputBuffering.php index 9ef49fb63e..0b1c42834f 100644 --- a/libraries/classes/OutputBuffering.php +++ b/libraries/classes/OutputBuffering.php @@ -97,10 +97,8 @@ class OutputBuffering * This function will need to run at the top of all pages if output * output buffering is turned on. It also needs to be passed $mode from * the PMA_outBufferModeGet() function or it will be useless. - * - * @return void */ - public function start() + public function start(): void { if ($this->on) { return; @@ -135,10 +133,8 @@ class OutputBuffering * This function will need to run at the bottom of all pages if output * buffering is turned on. It also needs to be passed $mode from the * PMA_outBufferModeGet() function or it will be useless. - * - * @return void */ - public static function stop() + public static function stop(): void { $buffer = self::getInstance(); if (! $buffer->on) { @@ -166,10 +162,8 @@ class OutputBuffering /** * Flushes output buffer - * - * @return void */ - public function flush() + public function flush(): void { if (ob_get_status() && $this->mode) { ob_flush(); diff --git a/libraries/classes/Partitioning/Partition.php b/libraries/classes/Partitioning/Partition.php index d132701574..e43a97c0e9 100644 --- a/libraries/classes/Partitioning/Partition.php +++ b/libraries/classes/Partitioning/Partition.php @@ -23,10 +23,8 @@ class Partition extends SubPartition * Loads data from the fetched row from information_schema.PARTITIONS * * @param array $row fetched row - * - * @return void */ - protected function loadData(array $row) + protected function loadData(array $row): void { $this->name = $row['PARTITION_NAME']; $this->ordinal = $row['PARTITION_ORDINAL_POSITION']; @@ -55,10 +53,8 @@ class Partition extends SubPartition * Add a sub partition * * @param SubPartition $partition Sub partition - * - * @return void */ - public function addSubPartition(SubPartition $partition) + public function addSubPartition(SubPartition $partition): void { $this->subPartitions[] = $partition; } diff --git a/libraries/classes/Partitioning/SubPartition.php b/libraries/classes/Partitioning/SubPartition.php index 44b2271326..fe3be3b053 100644 --- a/libraries/classes/Partitioning/SubPartition.php +++ b/libraries/classes/Partitioning/SubPartition.php @@ -49,10 +49,8 @@ class SubPartition * Loads data from the fetched row from information_schema.PARTITIONS * * @param array $row fetched row - * - * @return void */ - protected function loadData(array $row) + protected function loadData(array $row): void { $this->name = $row['SUBPARTITION_NAME']; $this->ordinal = $row['SUBPARTITION_ORDINAL_POSITION']; @@ -65,10 +63,8 @@ class SubPartition * Loads some data that is common to both partitions and sub partitions * * @param array $row fetched row - * - * @return void */ - protected function loadCommonData(array $row) + protected function loadCommonData(array $row): void { $this->rows = $row['TABLE_ROWS']; $this->dataLength = $row['DATA_LENGTH']; diff --git a/libraries/classes/Pdf.php b/libraries/classes/Pdf.php index bf91d39ff8..a51234528c 100644 --- a/libraries/classes/Pdf.php +++ b/libraries/classes/Pdf.php @@ -75,11 +75,9 @@ class Pdf extends TCPDF /** * This function must be named "Footer" to work with the TCPDF library - * - * @return void */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Footer() + public function Footer(): void { // Check if footer for this page already exists if (isset($this->footerset[$this->page])) { @@ -109,10 +107,8 @@ class Pdf extends TCPDF * * @param string $name name of the alias * @param string $value value of the alias - * - * @return void */ - public function setAlias($name, $value) + public function setAlias($name, $value): void { // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $name = TCPDF_FONTS::UTF8ToUTF16BE( @@ -134,10 +130,8 @@ class Pdf extends TCPDF /** * Improved with alias expanding. - * - * @return void */ - public function _putpages() + public function _putpages(): void { if (count($this->alias) > 0) { $nbPages = count($this->pages); @@ -155,11 +149,9 @@ class Pdf extends TCPDF * Displays an error message * * @param string $error_message the error message - * - * @return void */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Error($error_message = '') + public function Error($error_message = ''): void { echo Message::error( __('Error while creating PDF:') . ' ' . $error_message @@ -171,10 +163,8 @@ class Pdf extends TCPDF * Sends file as a download to user. * * @param string $filename file name - * - * @return void */ - public function download($filename) + public function download($filename): void { $pdfData = $this->getPDFData(); ResponseRenderer::getInstance()->disable(); diff --git a/libraries/classes/Plugins/Auth/AuthenticationConfig.php b/libraries/classes/Plugins/Auth/AuthenticationConfig.php index 693ee3a6f5..e0d1c3897a 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationConfig.php +++ b/libraries/classes/Plugins/Auth/AuthenticationConfig.php @@ -70,10 +70,8 @@ class AuthenticationConfig extends AuthenticationPlugin * User is not allowed to login to MySQL -> authentication failed * * @param string $failure String describing why authentication has failed - * - * @return void */ - public function showFailure($failure) + public function showFailure($failure): void { global $dbi; diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index e2e60f761d..8b25502e23 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -79,10 +79,8 @@ class AuthenticationCookie extends AuthenticationPlugin * Forces (not)using of openSSL * * @param bool $use The flag - * - * @return void */ - public function setUseOpenSSL($use) + public function setUseOpenSSL($use): void { $this->useOpenSsl = $use; } @@ -597,10 +595,8 @@ class AuthenticationCookie extends AuthenticationPlugin * Stores username in a cookie. * * @param string $username User name - * - * @return void */ - public function storeUsernameCookie($username) + public function storeUsernameCookie($username): void { // Name and password cookies need to be refreshed each time // Duration = one month for username @@ -617,10 +613,8 @@ class AuthenticationCookie extends AuthenticationPlugin * Stores password in a cookie. * * @param string $password Password - * - * @return void */ - public function storePasswordCookie($password) + public function storePasswordCookie($password): void { $payload = ['password' => $password]; if ($GLOBALS['cfg']['AllowArbitraryServer'] && ! empty($GLOBALS['pma_auth_server'])) { @@ -649,10 +643,8 @@ class AuthenticationCookie extends AuthenticationPlugin * currently done by call to showLoginForm() * * @param string $failure String describing why authentication has failed - * - * @return void */ - public function showFailure($failure) + public function showFailure($failure): void { global $conn_error; @@ -775,10 +767,8 @@ class AuthenticationCookie extends AuthenticationPlugin * In neither case the error is useful to user, but we need to clear * the error buffer as otherwise the errors would pop up later, for * example during MySQL SSL setup. - * - * @return void */ - public function cleanSSLErrors() + public function cleanSSLErrors(): void { if (! function_exists('openssl_error_string')) { return; @@ -928,10 +918,8 @@ class AuthenticationCookie extends AuthenticationPlugin * This is for testing only! * * @param string $vector The IV - * - * @return void */ - public function setIV($vector) + public function setIV($vector): void { $this->cookieIv = $vector; } @@ -940,20 +928,16 @@ class AuthenticationCookie extends AuthenticationPlugin * Callback when user changes password. * * @param string $password New password to set - * - * @return void */ - public function handlePasswordChange($password) + public function handlePasswordChange($password): void { $this->storePasswordCookie($password); } /** * Perform logout - * - * @return void */ - public function logOut() + public function logOut(): void { global $config; diff --git a/libraries/classes/Plugins/Auth/AuthenticationHttp.php b/libraries/classes/Plugins/Auth/AuthenticationHttp.php index 7da9d3466b..5e1e74ca5e 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationHttp.php +++ b/libraries/classes/Plugins/Auth/AuthenticationHttp.php @@ -200,10 +200,8 @@ class AuthenticationHttp extends AuthenticationPlugin * User is not allowed to login to MySQL -> authentication failed * * @param string $failure String describing why authentication has failed - * - * @return void */ - public function showFailure($failure) + public function showFailure($failure): void { global $dbi; diff --git a/libraries/classes/Plugins/Auth/AuthenticationSignon.php b/libraries/classes/Plugins/Auth/AuthenticationSignon.php index 85e3e640d5..d8f3e6a00e 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationSignon.php +++ b/libraries/classes/Plugins/Auth/AuthenticationSignon.php @@ -273,10 +273,8 @@ class AuthenticationSignon extends AuthenticationPlugin * User is not allowed to login to MySQL -> authentication failed * * @param string $failure String describing why authentication has failed - * - * @return void */ - public function showFailure($failure) + public function showFailure($failure): void { parent::showFailure($failure); diff --git a/libraries/classes/Plugins/AuthenticationPlugin.php b/libraries/classes/Plugins/AuthenticationPlugin.php index a1e388f282..7e216a2126 100644 --- a/libraries/classes/Plugins/AuthenticationPlugin.php +++ b/libraries/classes/Plugins/AuthenticationPlugin.php @@ -105,20 +105,16 @@ abstract class AuthenticationPlugin * User is not allowed to login to MySQL -> authentication failed * * @param string $failure String describing why authentication has failed - * - * @return void */ - public function showFailure($failure) + public function showFailure($failure): void { Logging::logUser($this->user, $failure); } /** * Perform logout - * - * @return void */ - public function logOut() + public function logOut(): void { global $config; @@ -225,10 +221,8 @@ abstract class AuthenticationPlugin * Callback when user changes password. * * @param string $password New password to set - * - * @return void */ - public function handlePasswordChange($password) + public function handlePasswordChange($password): void { } @@ -237,10 +231,8 @@ abstract class AuthenticationPlugin * * Tries to workaround PHP 5 session garbage collection which * looks at the session file's last modified time - * - * @return void */ - public function setSessionAccessTime() + public function setSessionAccessTime(): void { if (isset($_REQUEST['guid'])) { $guid = (string) $_REQUEST['guid']; @@ -266,10 +258,8 @@ abstract class AuthenticationPlugin * High level authentication interface * * Gets the credentials or shows login form if necessary - * - * @return void */ - public function authenticate() + public function authenticate(): void { $success = $this->readCredentials(); @@ -288,10 +278,8 @@ abstract class AuthenticationPlugin /** * Check configuration defined restrictions for authentication - * - * @return void */ - public function checkRules() + public function checkRules(): void { global $cfg; diff --git a/libraries/classes/Plugins/Export/ExportCodegen.php b/libraries/classes/Plugins/Export/ExportCodegen.php index f362606e27..3c5cf1e868 100644 --- a/libraries/classes/Plugins/Export/ExportCodegen.php +++ b/libraries/classes/Plugins/Export/ExportCodegen.php @@ -407,10 +407,8 @@ class ExportCodegen extends ExportPlugin * Setter for CodeGen formats * * @param array $CG_FORMATS contains CodeGen Formats - * - * @return void */ - private function setCgFormats(array $CG_FORMATS) + private function setCgFormats(array $CG_FORMATS): void { $this->cgFormats = $CG_FORMATS; } diff --git a/libraries/classes/Plugins/Export/ExportPdf.php b/libraries/classes/Plugins/Export/ExportPdf.php index 7a2d4a3fb2..424a5696aa 100644 --- a/libraries/classes/Plugins/Export/ExportPdf.php +++ b/libraries/classes/Plugins/Export/ExportPdf.php @@ -349,10 +349,8 @@ class ExportPdf extends ExportPlugin * Instantiates the PhpMyAdmin\Plugins\Export\Helpers\Pdf class * * @param Pdf $pdf The instance - * - * @return void */ - private function setPdf($pdf) + private function setPdf($pdf): void { $this->pdf = $pdf; } diff --git a/libraries/classes/Plugins/Export/ExportXml.php b/libraries/classes/Plugins/Export/ExportXml.php index c7e19625b9..10c60e7f05 100644 --- a/libraries/classes/Plugins/Export/ExportXml.php +++ b/libraries/classes/Plugins/Export/ExportXml.php @@ -570,10 +570,8 @@ class ExportXml extends ExportPlugin * Sets the table name * * @param string $table table name - * - * @return void */ - private function setTable($table) + private function setTable($table): void { $this->table = $table; } @@ -592,10 +590,8 @@ class ExportXml extends ExportPlugin * Sets the table names * * @param array $tables table names - * - * @return void */ - private function setTables(array $tables) + private function setTables(array $tables): void { $this->tables = $tables; } diff --git a/libraries/classes/Plugins/Export/Helpers/Pdf.php b/libraries/classes/Plugins/Export/Helpers/Pdf.php index 2f7d0fb976..8bc315cb1f 100644 --- a/libraries/classes/Plugins/Export/Helpers/Pdf.php +++ b/libraries/classes/Plugins/Export/Helpers/Pdf.php @@ -188,11 +188,9 @@ class Pdf extends PdfLib /** * This method is used to render the page header. - * - * @return void */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Header() + public function Header(): void { global $maxY; // We don't want automatic page breaks while generating header @@ -276,10 +274,8 @@ class Pdf extends PdfLib * Generate table * * @param int $lineheight Height of line - * - * @return void */ - public function morepagestable($lineheight = 8) + public function morepagestable($lineheight = 8): void { global $dbi; @@ -369,10 +365,8 @@ class Pdf extends PdfLib * The method can be called before creating the first page. * * @param float $topMargin the margin - * - * @return void */ - public function setTopMargin($topMargin) + public function setTopMargin($topMargin): void { $this->tMargin = $topMargin; } @@ -382,10 +376,8 @@ class Pdf extends PdfLib * * @param string $db database name * @param string $table table name - * - * @return void */ - public function getTriggers($db, $table) + public function getTriggers($db, $table): void { global $dbi; @@ -527,8 +519,6 @@ class Pdf extends PdfLib * @param bool $do_mime whether to include mime comments * @param bool $view whether we're handling a view * @param array $aliases aliases of db/table/columns - * - * @return void */ public function getTableDef( $db, @@ -538,7 +528,7 @@ class Pdf extends PdfLib $do_mime, $view = false, array $aliases = [] - ) { + ): void { global $dbi; // set $cfgRelation here, because there is a chance that it's modified @@ -759,10 +749,8 @@ class Pdf extends PdfLib * MySQL report * * @param string $query Query to execute - * - * @return void */ - public function mysqlReport($query) + public function mysqlReport($query): void { global $dbi; diff --git a/libraries/classes/Plugins/ExportPlugin.php b/libraries/classes/Plugins/ExportPlugin.php index 19a6a1d3f6..1eb8670ad0 100644 --- a/libraries/classes/Plugins/ExportPlugin.php +++ b/libraries/classes/Plugins/ExportPlugin.php @@ -280,10 +280,8 @@ abstract class ExportPlugin implements Plugin * @param array $aliases Alias information for db/table/column * @param string $db the database * @param string $table the table - * - * @return void */ - public function initAlias($aliases, &$db, &$table = null) + public function initAlias($aliases, &$db, &$table = null): void { if (! empty($aliases[$db]['tables'][$table]['alias'])) { $table = $aliases[$db]['tables'][$table]['alias']; diff --git a/libraries/classes/Plugins/IOTransformationsPlugin.php b/libraries/classes/Plugins/IOTransformationsPlugin.php index 10502b070c..2fd74e1859 100644 --- a/libraries/classes/Plugins/IOTransformationsPlugin.php +++ b/libraries/classes/Plugins/IOTransformationsPlugin.php @@ -90,10 +90,8 @@ abstract class IOTransformationsPlugin extends TransformationsPlugin /** * Resets the object properties - * - * @return void */ - public function reset() + public function reset(): void { $this->success = true; $this->error = ''; diff --git a/libraries/classes/Plugins/Import/ImportCsv.php b/libraries/classes/Plugins/Import/ImportCsv.php index 5e9adf25c6..c0a22bd62d 100644 --- a/libraries/classes/Plugins/Import/ImportCsv.php +++ b/libraries/classes/Plugins/Import/ImportCsv.php @@ -156,10 +156,8 @@ class ImportCsv extends AbstractImportCsv * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $error, $message, $dbi; global $db, $table, $csv_terminated, $csv_enclosed, $csv_escaped, @@ -958,10 +956,8 @@ class ImportCsv extends AbstractImportCsv * Sets to true if the table should be analyzed, false otherwise * * @param bool $analyze status - * - * @return void */ - private function setAnalyze($analyze) + private function setAnalyze($analyze): void { $this->analyze = $analyze; } diff --git a/libraries/classes/Plugins/Import/ImportLdi.php b/libraries/classes/Plugins/Import/ImportLdi.php index a812e8daa3..4dbeb253e5 100644 --- a/libraries/classes/Plugins/Import/ImportLdi.php +++ b/libraries/classes/Plugins/Import/ImportLdi.php @@ -88,10 +88,8 @@ class ImportLdi extends AbstractImportCsv * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $finished, $import_file, $charset_conversion, $table, $dbi; global $ldi_local_option, $ldi_replace, $ldi_ignore, $ldi_terminated, diff --git a/libraries/classes/Plugins/Import/ImportMediawiki.php b/libraries/classes/Plugins/Import/ImportMediawiki.php index 1805ee8ece..1314da422d 100644 --- a/libraries/classes/Plugins/Import/ImportMediawiki.php +++ b/libraries/classes/Plugins/Import/ImportMediawiki.php @@ -65,10 +65,8 @@ class ImportMediawiki extends ImportPlugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $error, $timeout_passed, $finished; @@ -311,11 +309,9 @@ class ImportMediawiki extends ImportPlugin * rows </code> * @param array $sql_data 2-element array with sql data * - * @return void - * * @global bool $analyze whether to scan for column types */ - private function importDataOneTable(array $table, array &$sql_data) + private function importDataOneTable(array $table, array &$sql_data): void { $analyze = $this->getAnalyze(); if ($analyze) { @@ -348,10 +344,8 @@ class ImportMediawiki extends ImportPlugin * Sets the table name * * @param string $table_name reference to the name of the table - * - * @return void */ - private function setTableName(&$table_name) + private function setTableName(&$table_name): void { global $dbi; @@ -370,10 +364,8 @@ class ImportMediawiki extends ImportPlugin * @param array $table_headers reference to the array containing the headers * of a table * @param array $table_row array containing the first content row - * - * @return void */ - private function setTableHeaders(array &$table_headers, array $table_row) + private function setTableHeaders(array &$table_headers, array $table_row): void { if (! empty($table_headers)) { return; @@ -402,11 +394,9 @@ class ImportMediawiki extends ImportPlugin * ) * @param array $sql_data 2-element array with sql data * - * @return void - * * @global string $db name of the database to import in */ - private function executeImportTables(array &$tables, array &$analyses, array &$sql_data) + private function executeImportTables(array &$tables, array &$analyses, array &$sql_data): void { global $db; @@ -554,10 +544,8 @@ class ImportMediawiki extends ImportPlugin * Sets to true if the table should be analyzed, false otherwise * * @param bool $analyze status - * - * @return void */ - private function setAnalyze($analyze) + private function setAnalyze($analyze): void { $this->analyze = $analyze; } diff --git a/libraries/classes/Plugins/Import/ImportOds.php b/libraries/classes/Plugins/Import/ImportOds.php index ed939296ab..14f9151433 100644 --- a/libraries/classes/Plugins/Import/ImportOds.php +++ b/libraries/classes/Plugins/Import/ImportOds.php @@ -102,10 +102,8 @@ class ImportOds extends ImportPlugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $db, $error, $timeout_passed, $finished; diff --git a/libraries/classes/Plugins/Import/ImportShp.php b/libraries/classes/Plugins/Import/ImportShp.php index 6059e78edb..069ba13e85 100644 --- a/libraries/classes/Plugins/Import/ImportShp.php +++ b/libraries/classes/Plugins/Import/ImportShp.php @@ -76,10 +76,8 @@ class ImportShp extends ImportPlugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $db, $error, $finished, $import_file, $local_import_file, $message, $dbi; diff --git a/libraries/classes/Plugins/Import/ImportSql.php b/libraries/classes/Plugins/Import/ImportSql.php index e8679538f9..5f27a1c3cc 100644 --- a/libraries/classes/Plugins/Import/ImportSql.php +++ b/libraries/classes/Plugins/Import/ImportSql.php @@ -100,10 +100,8 @@ class ImportSql extends ImportPlugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $error, $timeout_passed, $dbi; @@ -174,10 +172,8 @@ class ImportSql extends ImportPlugin * * @param DatabaseInterface $dbi Database interface * @param array $request Request array - * - * @return void */ - private function setSQLMode($dbi, array $request) + private function setSQLMode($dbi, array $request): void { $sql_modes = []; if ( diff --git a/libraries/classes/Plugins/Import/ImportXml.php b/libraries/classes/Plugins/Import/ImportXml.php index 5591d2393f..88e05b8dff 100644 --- a/libraries/classes/Plugins/Import/ImportXml.php +++ b/libraries/classes/Plugins/Import/ImportXml.php @@ -57,10 +57,8 @@ class ImportXml extends ImportPlugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - public function doImport(?File $importHandle = null, array &$sql_data = []) + public function doImport(?File $importHandle = null, array &$sql_data = []): void { global $error, $timeout_passed, $finished, $db; diff --git a/libraries/classes/Plugins/ImportPlugin.php b/libraries/classes/Plugins/ImportPlugin.php index 1a3d048d0a..4573d09949 100644 --- a/libraries/classes/Plugins/ImportPlugin.php +++ b/libraries/classes/Plugins/ImportPlugin.php @@ -48,10 +48,8 @@ abstract class ImportPlugin implements Plugin * Handles the whole import logic * * @param array $sql_data 2-element array with sql data - * - * @return void */ - abstract public function doImport(?File $importHandle = null, array &$sql_data = []); + abstract public function doImport(?File $importHandle = null, array &$sql_data = []): void; /** * Gets the import specific format plugin properties diff --git a/libraries/classes/Plugins/Schema/Dia/Dia.php b/libraries/classes/Plugins/Schema/Dia/Dia.php index 923108afb8..c070949753 100644 --- a/libraries/classes/Plugins/Schema/Dia/Dia.php +++ b/libraries/classes/Plugins/Schema/Dia/Dia.php @@ -66,8 +66,6 @@ class Dia extends XMLWriter * @param float $rightMargin right margin of the paper/document in cm * @param string $orientation orientation of the document, portrait or landscape * - * @return void - * * @access public */ public function startDiaDoc( @@ -77,7 +75,7 @@ class Dia extends XMLWriter $leftMargin, $rightMargin, $orientation - ) { + ): void { $isPortrait = 'false'; if ($orientation === 'P') { @@ -162,11 +160,9 @@ class Dia extends XMLWriter * @see XMLWriter::endElement() * @see XMLWriter::endDocument() * - * @return void - * * @access public */ - public function endDiaDoc() + public function endDiaDoc(): void { $this->endElement(); $this->endDocument(); @@ -179,11 +175,9 @@ class Dia extends XMLWriter * * @param string $fileName name of the dia document * - * @return void - * * @access public */ - public function showOutput($fileName) + public function showOutput($fileName): void { if (ob_get_clean()) { ob_end_clean(); diff --git a/libraries/classes/Plugins/Schema/Dia/DiaRelationSchema.php b/libraries/classes/Plugins/Schema/Dia/DiaRelationSchema.php index eb3899ad77..8f13d518c8 100644 --- a/libraries/classes/Plugins/Schema/Dia/DiaRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Dia/DiaRelationSchema.php @@ -151,11 +151,9 @@ class DiaRelationSchema extends ExportRelationSchema /** * Output Dia Document for download * - * @return void - * * @access public */ - public function showOutput() + public function showOutput(): void { $this->diagram->showOutput($this->getFileName('.dia')); } @@ -171,8 +169,6 @@ class DiaRelationSchema extends ExportRelationSchema * @param string $foreignField The relation field in the foreign table * @param bool $showKeys Whether to display ONLY keys or not * - * @return void - * * @access private */ private function addRelation( @@ -181,7 +177,7 @@ class DiaRelationSchema extends ExportRelationSchema $foreignTable, $foreignField, $showKeys - ) { + ): void { if (! isset($this->tables[$masterTable])) { $this->tables[$masterTable] = new TableStatsDia( $this->diagram, @@ -220,11 +216,9 @@ class DiaRelationSchema extends ExportRelationSchema * * @see RelationStatsDia::relationDraw() * - * @return void - * * @access private */ - private function drawRelations() + private function drawRelations(): void { foreach ($this->relations as $relation) { $relation->relationDraw($this->showColor); @@ -239,11 +233,9 @@ class DiaRelationSchema extends ExportRelationSchema * * @see TableStatsDia::tableDraw() * - * @return void - * * @access private */ - private function drawTables() + private function drawTables(): void { foreach ($this->tables as $table) { $table->tableDraw($this->showColor); diff --git a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php index 2363e2200c..83d50d1404 100644 --- a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php +++ b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php @@ -67,10 +67,8 @@ class TableStatsDia extends TableStats /** * Displays an error when the table cannot be found. - * - * @return void */ - protected function showMissingTableError() + protected function showMissingTableError(): void { ExportRelationSchema::dieSchema( $this->pageNumber, @@ -95,11 +93,9 @@ class TableStatsDia extends TableStats * will be used to choose the random colors for tables * text we can change/add more colors to this array * - * @return void - * * @access public */ - public function tableDraw($showColor) + public function tableDraw($showColor): void { if ($showColor) { $listOfColors = [ diff --git a/libraries/classes/Plugins/Schema/Eps/Eps.php b/libraries/classes/Plugins/Schema/Eps/Eps.php index 702a5c44e5..e92d511b43 100644 --- a/libraries/classes/Plugins/Schema/Eps/Eps.php +++ b/libraries/classes/Plugins/Schema/Eps/Eps.php @@ -48,10 +48,8 @@ class Eps * Set document title * * @param string $value sets the title text - * - * @return void */ - public function setTitle($value) + public function setTitle($value): void { $this->stringCommands .= '%%Title: ' . $value . "\n"; } @@ -60,10 +58,8 @@ class Eps * Set document author * * @param string $value sets the author - * - * @return void */ - public function setAuthor($value) + public function setAuthor($value): void { $this->stringCommands .= '%%Creator: ' . $value . "\n"; } @@ -72,10 +68,8 @@ class Eps * Set document creation date * * @param string $value sets the date - * - * @return void */ - public function setDate($value) + public function setDate($value): void { $this->stringCommands .= '%%CreationDate: ' . $value . "\n"; } @@ -84,10 +78,8 @@ class Eps * Set document orientation * * @param string $orientation sets the orientation - * - * @return void */ - public function setOrientation($orientation) + public function setOrientation($orientation): void { $this->stringCommands .= "%%PageOrder: Ascend \n"; if ($orientation === 'L') { @@ -156,8 +148,6 @@ class Eps * @param int $y_to The y_to attribute defines the end * right position of the element * @param int $lineWidth Sets the width of the line e.g 2 - * - * @return void */ public function line( $x_from = 0, @@ -165,7 +155,7 @@ class Eps $x_to = 0, $y_to = 0, $lineWidth = 0 - ) { + ): void { $this->stringCommands .= $lineWidth . " setlinewidth \n"; $this->stringCommands .= $x_from . ' ' . $y_from . " moveto \n"; $this->stringCommands .= $x_to . ' ' . $y_to . " lineto \n"; @@ -187,10 +177,8 @@ class Eps * @param int $y_to The y_to attribute defines the end * right position of the element * @param int $lineWidth Sets the width of the line e.g 2 - * - * @return void */ - public function rect($x_from, $y_from, $x_to, $y_to, $lineWidth) + public function rect($x_from, $y_from, $x_to, $y_to, $lineWidth): void { $this->stringCommands .= $lineWidth . " setlinewidth \n"; $this->stringCommands .= "newpath \n"; @@ -211,10 +199,8 @@ class Eps * * @param int $x The x attribute defines the left position of the element * @param int $y The y attribute defines the right position of the element - * - * @return void */ - public function moveTo($x, $y) + public function moveTo($x, $y): void { $this->stringCommands .= $x . ' ' . $y . " moveto \n"; } @@ -223,10 +209,8 @@ class Eps * Output/Display the text * * @param string $text The string to be displayed - * - * @return void */ - public function show($text) + public function show($text): void { $this->stringCommands .= '(' . $text . ") show \n"; } @@ -237,10 +221,8 @@ class Eps * @param string $text String to be displayed * @param int $x X attribute defines the left position of the element * @param int $y Y attribute defines the right position of the element - * - * @return void */ - public function showXY($text, $x, $y) + public function showXY($text, $x, $y): void { $this->moveTo($x, $y); $this->show($text); @@ -248,10 +230,8 @@ class Eps /** * Ends EPS Document - * - * @return void */ - public function endEpsDoc() + public function endEpsDoc(): void { $this->stringCommands .= "showpage \n"; } @@ -260,10 +240,8 @@ class Eps * Output EPS Document for download * * @param string $fileName name of the eps document - * - * @return void */ - public function showOutput($fileName) + public function showOutput($fileName): void { // if(ob_get_clean()){ //ob_end_clean(); diff --git a/libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php b/libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php index 59ff74a5c0..4edddf53a8 100644 --- a/libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php @@ -154,10 +154,8 @@ class EpsRelationSchema extends ExportRelationSchema /** * Output Eps Document for download - * - * @return void */ - public function showOutput() + public function showOutput(): void { $this->diagram->showOutput($this->getFileName('.eps')); } @@ -176,8 +174,6 @@ class EpsRelationSchema extends ExportRelationSchema * @param string $foreignTable The foreign table name * @param string $foreignField The relation field in the foreign table * @param bool $tableDimension Whether to display table position or not - * - * @return void */ private function addRelation( $masterTable, @@ -187,7 +183,7 @@ class EpsRelationSchema extends ExportRelationSchema $foreignTable, $foreignField, $tableDimension - ) { + ): void { if (! isset($this->tables[$masterTable])) { $this->tables[$masterTable] = new TableStatsEps( $this->diagram, @@ -230,10 +226,8 @@ class EpsRelationSchema extends ExportRelationSchema * foreign table's foreign field * * @see RelationStatsEps::relationDraw() - * - * @return void */ - private function drawRelations() + private function drawRelations(): void { foreach ($this->relations as $relation) { $relation->relationDraw(); @@ -244,10 +238,8 @@ class EpsRelationSchema extends ExportRelationSchema * Draws tables * * @see TableStatsEps::Table_Stats_tableDraw() - * - * @return void */ - private function drawTables() + private function drawTables(): void { foreach ($this->tables as $table) { $table->tableDraw($this->showColor); diff --git a/libraries/classes/Plugins/Schema/Eps/RelationStatsEps.php b/libraries/classes/Plugins/Schema/Eps/RelationStatsEps.php index bce253874c..b56bb381ae 100644 --- a/libraries/classes/Plugins/Schema/Eps/RelationStatsEps.php +++ b/libraries/classes/Plugins/Schema/Eps/RelationStatsEps.php @@ -54,10 +54,8 @@ class RelationStatsEps extends RelationStats * shows foreign key relations * * @see Eps - * - * @return void */ - public function relationDraw() + public function relationDraw(): void { // draw a line like -- to foreign field $this->diagram->line( diff --git a/libraries/classes/Plugins/Schema/Eps/TableStatsEps.php b/libraries/classes/Plugins/Schema/Eps/TableStatsEps.php index a98e38158e..5696accd57 100644 --- a/libraries/classes/Plugins/Schema/Eps/TableStatsEps.php +++ b/libraries/classes/Plugins/Schema/Eps/TableStatsEps.php @@ -86,10 +86,8 @@ class TableStatsEps extends TableStats /** * Displays an error when the table cannot be found. - * - * @return void */ - protected function showMissingTableError() + protected function showMissingTableError(): void { ExportRelationSchema::dieSchema( $this->pageNumber, @@ -105,10 +103,8 @@ class TableStatsEps extends TableStats * * @param string $font The font name * @param int $fontSize The font size - * - * @return void */ - private function setWidthTable($font, $fontSize) + private function setWidthTable($font, $fontSize): void { foreach ($this->fields as $field) { $this->width = max( @@ -142,10 +138,8 @@ class TableStatsEps extends TableStats * Sets the height of the table * * @param int $fontSize The font size - * - * @return void */ - private function setHeightTable($fontSize) + private function setHeightTable($fontSize): void { $this->heightCell = $fontSize + 4; $this->height = (count($this->fields) + 1) * $this->heightCell; @@ -159,10 +153,8 @@ class TableStatsEps extends TableStats * @see Eps::rect * * @param bool $showColor Whether to display color - * - * @return void */ - public function tableDraw($showColor) + public function tableDraw($showColor): void { $this->diagram->rect( $this->x, diff --git a/libraries/classes/Plugins/Schema/ExportRelationSchema.php b/libraries/classes/Plugins/Schema/ExportRelationSchema.php index c556826e30..981f1de7ae 100644 --- a/libraries/classes/Plugins/Schema/ExportRelationSchema.php +++ b/libraries/classes/Plugins/Schema/ExportRelationSchema.php @@ -291,11 +291,9 @@ class ExportRelationSchema * @param string $type Schema Type * @param string $error_message The error message * - * @return void - * * @access public */ - public static function dieSchema($pageNumber, $type = '', $error_message = '') + public static function dieSchema($pageNumber, $type = '', $error_message = ''): void { echo '<p><strong>' , __('SCHEMA ERROR: ') , $type , '</strong></p>' , "\n"; if (! empty($error_message)) { diff --git a/libraries/classes/Plugins/Schema/Pdf/Pdf.php b/libraries/classes/Plugins/Schema/Pdf/Pdf.php index f673bcb59b..a614708351 100644 --- a/libraries/classes/Plugins/Schema/Pdf/Pdf.php +++ b/libraries/classes/Plugins/Schema/Pdf/Pdf.php @@ -116,10 +116,8 @@ class Pdf extends PdfLib * Sets the value for margins * * @param float $c_margin margin - * - * @return void */ - public function setCMargin($c_margin) + public function setCMargin($c_margin): void { $this->cMargin = $c_margin; } @@ -132,8 +130,6 @@ class Pdf extends PdfLib * @param float|int $yMin The minimum Y coordinate * @param float|int $leftMargin The left margin * @param float|int $topMargin The top margin - * - * @return void */ public function setScale( $scale = 1, @@ -141,7 +137,7 @@ class Pdf extends PdfLib $yMin = 0, $leftMargin = -1, $topMargin = -1 - ) { + ): void { $this->scale = $scale; $this->xMin = $xMin; $this->yMin = $yMin; @@ -169,8 +165,6 @@ class Pdf extends PdfLib * @param string $align Align mode * @param bool $fill Whether to fill the cell with a color or not * @param string $link Link - * - * @return void */ public function cellScale( $w, @@ -181,7 +175,7 @@ class Pdf extends PdfLib $align = '', bool $fill = false, $link = '' - ) { + ): void { $h /= $this->scale; $w /= $this->scale; $this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link); @@ -196,10 +190,8 @@ class Pdf extends PdfLib * @param float $y1 The vertical position of the starting point * @param float $x2 The horizontal position of the ending point * @param float $y2 The vertical position of the ending point - * - * @return void */ - public function lineScale($x1, $y1, $x2, $y2) + public function lineScale($x1, $y1, $x2, $y2): void { $x1 = ($x1 - $this->xMin) / $this->scale + $this->leftMargin; $y1 = ($y1 - $this->yMin) / $this->scale + $this->topMargin; @@ -215,10 +207,8 @@ class Pdf extends PdfLib * * @param float $x The x position * @param float $y The y position - * - * @return void */ - public function setXyScale($x, $y) + public function setXyScale($x, $y): void { $x = ($x - $this->xMin) / $this->scale + $this->leftMargin; $y = ($y - $this->yMin) / $this->scale + $this->topMargin; @@ -231,10 +221,8 @@ class Pdf extends PdfLib * @see TCPDF::SetX() * * @param float $x The x position - * - * @return void */ - public function setXScale($x) + public function setXScale($x): void { $x = ($x - $this->xMin) / $this->scale + $this->leftMargin; $this->SetX($x); @@ -246,10 +234,8 @@ class Pdf extends PdfLib * @see TCPDF::SetFontSize() * * @param float $size The font size (in points) - * - * @return void */ - public function setFontSizeScale($size) + public function setFontSizeScale($size): void { // Set font size in points $size /= $this->scale; @@ -262,10 +248,8 @@ class Pdf extends PdfLib * @see TCPDF::SetLineWidth() * * @param float $width The line width - * - * @return void */ - public function setLineWidthScale($width) + public function setLineWidthScale($width): void { $width /= $this->scale; $this->SetLineWidth($width); @@ -275,11 +259,9 @@ class Pdf extends PdfLib * This method is used to render the page header. * * @see TCPDF::Header() - * - * @return void */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Header() + public function Header(): void { global $dbi; @@ -318,11 +300,9 @@ class Pdf extends PdfLib * This function must be named "Footer" to work with the TCPDF library * * @see PDF::Footer() - * - * @return void */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Footer() + public function Footer(): void { if (! $this->withDoc) { return; @@ -335,10 +315,8 @@ class Pdf extends PdfLib * Sets widths * * @param array $w array of widths - * - * @return void */ - public function setWidths(array $w) + public function setWidths(array $w): void { // column widths $this->widths = $w; @@ -349,10 +327,8 @@ class Pdf extends PdfLib * * @param array $data Data for table * @param array $links Links for table cells - * - * @return void */ - public function row(array $data, array $links) + public function row(array $data, array $links): void { // line height $nb = 0; @@ -460,11 +436,9 @@ class Pdf extends PdfLib * * @param bool $value whether offline * - * @return void - * * @access private */ - public function setOffline($value) + public function setOffline($value): void { $this->offline = $value; } diff --git a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php index d20bc88831..2c32582e6d 100644 --- a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -274,10 +274,8 @@ class PdfRelationSchema extends ExportRelationSchema * Set Show Grid * * @param bool $value show grid of the document or not - * - * @return void */ - public function setShowGrid($value) + public function setShowGrid($value): void { $this->showGrid = $value; } @@ -296,10 +294,8 @@ class PdfRelationSchema extends ExportRelationSchema * Set Data Dictionary * * @param bool $value show selected database data dictionary or not - * - * @return void */ - public function setWithDataDictionary($value) + public function setWithDataDictionary($value): void { $this->withDoc = $value; } @@ -318,10 +314,8 @@ class PdfRelationSchema extends ExportRelationSchema * Sets the order of the table in data dictionary * * @param string $value table order - * - * @return void */ - public function setTableOrder($value) + public function setTableOrder($value): void { $this->tableOrder = $value; } @@ -338,10 +332,8 @@ class PdfRelationSchema extends ExportRelationSchema /** * Output Pdf Document for download - * - * @return void */ - public function showOutput() + public function showOutput(): void { $this->diagram->download($this->getFileName('.pdf')); } @@ -350,10 +342,8 @@ class PdfRelationSchema extends ExportRelationSchema * Sets X and Y minimum and maximum for a table cell * * @param TableStatsPdf $table The table name of which sets XY co-ordinates - * - * @return void */ - private function setMinMax($table) + private function setMinMax($table): void { $this->xMax = max($this->xMax, $table->x + $table->width); $this->yMax = max($this->yMax, $table->y + $table->height); @@ -370,15 +360,13 @@ class PdfRelationSchema extends ExportRelationSchema * @param string $masterField The relation field in the master table * @param string $foreignTable The foreign table name * @param string $foreignField The relation field in the foreign table - * - * @return void */ private function addRelation( $masterTable, $masterField, $foreignTable, $foreignField - ) { + ): void { if (! isset($this->tables[$masterTable])) { $this->tables[$masterTable] = new TableStatsPdf( $this->diagram, @@ -420,10 +408,8 @@ class PdfRelationSchema extends ExportRelationSchema * Draws the grid * * @see PMA_Schema_PDF - * - * @return void */ - private function strokeGrid() + private function strokeGrid(): void { $gridSize = 10; $labelHeight = 4; @@ -485,10 +471,8 @@ class PdfRelationSchema extends ExportRelationSchema * Draws relation arrows * * @see Relation_Stats_Pdf::relationdraw() - * - * @return void */ - private function drawRelations() + private function drawRelations(): void { $i = 0; foreach ($this->relations as $relation) { @@ -501,10 +485,8 @@ class PdfRelationSchema extends ExportRelationSchema * Draws tables * * @see TableStatsPdf::tableDraw() - * - * @return void */ - private function drawTables() + private function drawTables(): void { foreach ($this->tables as $table) { $table->tableDraw(null, $this->withDoc, $this->showColor); @@ -515,10 +497,8 @@ class PdfRelationSchema extends ExportRelationSchema * Generates data dictionary pages. * * @param array $alltables Tables to document. - * - * @return void */ - public function dataDictionaryDoc(array $alltables) + public function dataDictionaryDoc(array $alltables): void { global $dbi; diff --git a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php index 99931f2c86..19588251e9 100644 --- a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php +++ b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php @@ -57,11 +57,9 @@ class RelationStatsPdf extends RelationStats * @param bool $showColor Whether to use one color per relation or not * @param int $i The id of the link to draw * - * @return void - * * @access public */ - public function relationDraw($showColor, $i) + public function relationDraw($showColor, $i): void { if ($showColor) { $d = $i % 6; diff --git a/libraries/classes/Plugins/Schema/Pdf/TableStatsPdf.php b/libraries/classes/Plugins/Schema/Pdf/TableStatsPdf.php index d9bdb01293..386953194e 100644 --- a/libraries/classes/Plugins/Schema/Pdf/TableStatsPdf.php +++ b/libraries/classes/Plugins/Schema/Pdf/TableStatsPdf.php @@ -89,10 +89,8 @@ class TableStatsPdf extends TableStats /** * Displays an error when the table cannot be found. - * - * @return void */ - protected function showMissingTableError() + protected function showMissingTableError(): void { ExportRelationSchema::dieSchema( $this->pageNumber, @@ -124,11 +122,9 @@ class TableStatsPdf extends TableStats * * @param int $fontSize The font size * - * @return void - * * @access private */ - private function setWidth($fontSize) + private function setWidth($fontSize): void { foreach ($this->fields as $field) { $this->width = max($this->width, $this->diagram->GetStringWidth($field)); @@ -150,11 +146,9 @@ class TableStatsPdf extends TableStats /** * Sets the height of the table * - * @return void - * * @access private */ - private function setHeight() + private function setHeight(): void { $this->height = (count($this->fields) + 1) * $this->heightCell; } @@ -168,11 +162,9 @@ class TableStatsPdf extends TableStats * @param bool $withDoc Whether to include links to documentation * @param bool $setColor Whether to display color * - * @return void - * * @access public */ - public function tableDraw(?int $fontSize, bool $withDoc, bool $setColor = false) + public function tableDraw(?int $fontSize, bool $withDoc, bool $setColor = false): void { $this->diagram->setXyScale($this->x, $this->y); $this->diagram->SetFont($this->ff, 'B', $fontSize); diff --git a/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php b/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php index b8db415372..b00e4a9c06 100644 --- a/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php +++ b/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php @@ -55,11 +55,9 @@ class RelationStatsSvg extends RelationStats * * @param bool $showColor Whether to use one color per relation or not * - * @return void - * * @access public */ - public function relationDraw($showColor) + public function relationDraw($showColor): void { if ($showColor) { $listOfColors = [ diff --git a/libraries/classes/Plugins/Schema/Svg/Svg.php b/libraries/classes/Plugins/Schema/Svg/Svg.php index a0b8a0df64..f8b59d695e 100644 --- a/libraries/classes/Plugins/Schema/Svg/Svg.php +++ b/libraries/classes/Plugins/Schema/Svg/Svg.php @@ -72,10 +72,8 @@ class Svg extends XMLWriter * Set document title * * @param string $value sets the title text - * - * @return void */ - public function setTitle($value) + public function setTitle($value): void { $this->title = $value; } @@ -84,10 +82,8 @@ class Svg extends XMLWriter * Set document author * * @param string $value sets the author - * - * @return void */ - public function setAuthor($value) + public function setAuthor($value): void { $this->author = $value; } @@ -146,10 +142,8 @@ class Svg extends XMLWriter * @param int $height total height of the RelationStatsSvg document * @param int $x min-x of the view box * @param int $y min-y of the view box - * - * @return void */ - public function startSvgDoc($width, $height, $x = 0, $y = 0) + public function startSvgDoc($width, $height, $x = 0, $y = 0): void { $this->startElement('svg'); @@ -176,10 +170,8 @@ class Svg extends XMLWriter * * @see XMLWriter::endElement() * @see XMLWriter::endDocument() - * - * @return void */ - public function endSvgDoc() + public function endSvgDoc(): void { $this->endElement(); $this->endDocument(); @@ -196,10 +188,8 @@ class Svg extends XMLWriter * @see XMLWriter::writeAttribute() * * @param string $fileName file name - * - * @return void */ - public function showOutput($fileName) + public function showOutput($fileName): void { //ob_get_clean(); $output = $this->flush(); @@ -236,8 +226,6 @@ class Svg extends XMLWriter * @param string|null $text The text attribute defines the text the element * @param string $styles The style attribute defines the style the element * styles can be defined like CSS styles - * - * @return void */ public function printElement( $name, @@ -247,7 +235,7 @@ class Svg extends XMLWriter $height = '', ?string $text = '', $styles = '' - ) { + ): void { $this->startElement($name); $this->writeAttribute('width', (string) $width); $this->writeAttribute('height', (string) $height); @@ -281,10 +269,8 @@ class Svg extends XMLWriter * @param int $y2 Defines the end of the line on the y-axis * @param string $styles The style attribute defines the style the element * styles can be defined like CSS styles - * - * @return void */ - public function printElementLine($name, $x1, $y1, $x2, $y2, $styles) + public function printElementLine($name, $x1, $y1, $x2, $y2, $styles): void { $this->startElement($name); $this->writeAttribute('x1', (string) $x1); diff --git a/libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php b/libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php index 23c2aa413d..7b2e9f4f92 100644 --- a/libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php @@ -177,10 +177,8 @@ class SvgRelationSchema extends ExportRelationSchema /** * Output RelationStatsSvg Document for download - * - * @return void */ - public function showOutput() + public function showOutput(): void { $this->diagram->showOutput($this->getFileName('.svg')); } @@ -189,10 +187,8 @@ class SvgRelationSchema extends ExportRelationSchema * Sets X and Y minimum and maximum for a table cell * * @param TableStatsSvg $table The table - * - * @return void */ - private function setMinMax($table) + private function setMinMax($table): void { $this->xMax = max($this->xMax, $table->x + $table->width); $this->yMax = max($this->yMax, $table->y + $table->height); @@ -213,8 +209,6 @@ class SvgRelationSchema extends ExportRelationSchema * @param string $foreignTable The foreign table name * @param string $foreignField The relation field in the foreign table * @param bool $tableDimension Whether to display table position or not - * - * @return void */ private function addRelation( $masterTable, @@ -224,7 +218,7 @@ class SvgRelationSchema extends ExportRelationSchema $foreignTable, $foreignField, $tableDimension - ) { + ): void { if (! isset($this->tables[$masterTable])) { $this->tables[$masterTable] = new TableStatsSvg( $this->diagram, @@ -270,10 +264,8 @@ class SvgRelationSchema extends ExportRelationSchema * foreign table's foreign field * * @see Relation_Stats_Svg::relationDraw() - * - * @return void */ - private function drawRelations() + private function drawRelations(): void { foreach ($this->relations as $relation) { $relation->relationDraw($this->showColor); @@ -284,10 +276,8 @@ class SvgRelationSchema extends ExportRelationSchema * Draws tables * * @see TableStatsSvg::Table_Stats_tableDraw() - * - * @return void */ - private function drawTables() + private function drawTables(): void { foreach ($this->tables as $table) { $table->tableDraw($this->showColor); diff --git a/libraries/classes/Plugins/Schema/TableStats.php b/libraries/classes/Plugins/Schema/TableStats.php index ae995c07ce..58a3a6e203 100644 --- a/libraries/classes/Plugins/Schema/TableStats.php +++ b/libraries/classes/Plugins/Schema/TableStats.php @@ -124,10 +124,8 @@ abstract class TableStats /** * Validate whether the table exists. - * - * @return void */ - protected function validateTableAndLoadFields() + protected function validateTableAndLoadFields(): void { global $dbi; @@ -162,18 +160,14 @@ abstract class TableStats /** * Displays an error when the table cannot be found. * - * @return void - * * @abstract */ - abstract protected function showMissingTableError(); + abstract protected function showMissingTableError(): void; /** * Loads coordinates of a table - * - * @return void */ - protected function loadCoordinates() + protected function loadCoordinates(): void { if (! isset($_POST['t_h'])) { return; @@ -192,20 +186,16 @@ abstract class TableStats /** * Loads the table's display field - * - * @return void */ - protected function loadDisplayField() + protected function loadDisplayField(): void { $this->displayfield = $this->relation->getDisplayField($this->db, $this->tableName); } /** * Loads the PRIMARY key. - * - * @return void */ - protected function loadPrimaryKey() + protected function loadPrimaryKey(): void { global $dbi; diff --git a/libraries/classes/Plugins/SchemaPlugin.php b/libraries/classes/Plugins/SchemaPlugin.php index 510d54a361..77953236e4 100644 --- a/libraries/classes/Plugins/SchemaPlugin.php +++ b/libraries/classes/Plugins/SchemaPlugin.php @@ -70,10 +70,8 @@ abstract class SchemaPlugin implements Plugin * Adds export options common to all plugins. * * @param OptionsPropertyMainGroup $propertyGroup property group - * - * @return void */ - protected function addCommonOptions(OptionsPropertyMainGroup $propertyGroup) + protected function addCommonOptions(OptionsPropertyMainGroup $propertyGroup): void { $leaf = new BoolPropertyItem('show_color', __('Show color')); $propertyGroup->addProperty($leaf); diff --git a/libraries/classes/Plugins/TwoFactor/Key.php b/libraries/classes/Plugins/TwoFactor/Key.php index 54ce218329..4f46d09948 100644 --- a/libraries/classes/Plugins/TwoFactor/Key.php +++ b/libraries/classes/Plugins/TwoFactor/Key.php @@ -105,10 +105,8 @@ class Key extends TwoFactorPlugin /** * Loads needed javascripts into the page - * - * @return void */ - public function loadScripts() + public function loadScripts(): void { $response = ResponseRenderer::getInstance(); $scripts = $response->getHeader()->getScripts(); diff --git a/libraries/classes/Properties/Options/Groups/OptionsPropertySubgroup.php b/libraries/classes/Properties/Options/Groups/OptionsPropertySubgroup.php index bc651447f3..a4686cf7b5 100644 --- a/libraries/classes/Properties/Options/Groups/OptionsPropertySubgroup.php +++ b/libraries/classes/Properties/Options/Groups/OptionsPropertySubgroup.php @@ -49,10 +49,8 @@ class OptionsPropertySubgroup extends OptionsPropertyGroup * Sets the subgroup header * * @param PropertyItem $subgroupHeader subgroup header - * - * @return void */ - public function setSubgroupHeader($subgroupHeader) + public function setSubgroupHeader($subgroupHeader): void { $this->subgroupHeader = $subgroupHeader; } diff --git a/libraries/classes/Properties/Options/OptionsPropertyGroup.php b/libraries/classes/Properties/Options/OptionsPropertyGroup.php index 968eeec3cb..dd1cd33aa9 100644 --- a/libraries/classes/Properties/Options/OptionsPropertyGroup.php +++ b/libraries/classes/Properties/Options/OptionsPropertyGroup.php @@ -33,10 +33,8 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem implements Count * * @param OptionsPropertyItem $property the property instance to be added * to the group - * - * @return void */ - public function addProperty($property) + public function addProperty($property): void { if ( ! $this->getProperties() == null @@ -53,10 +51,8 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem implements Count * * @param OptionsPropertyItem $property the property instance to be removed * from the group - * - * @return void */ - public function removeProperty($property) + public function removeProperty($property): void { $this->properties = array_diff( $this->getProperties(), diff --git a/libraries/classes/Properties/Options/OptionsPropertyItem.php b/libraries/classes/Properties/Options/OptionsPropertyItem.php index dba1128335..5e448c32e5 100644 --- a/libraries/classes/Properties/Options/OptionsPropertyItem.php +++ b/libraries/classes/Properties/Options/OptionsPropertyItem.php @@ -69,10 +69,8 @@ abstract class OptionsPropertyItem extends PropertyItem * Sets the name * * @param string $name name - * - * @return void */ - public function setName($name) + public function setName($name): void { $this->name = $name; } @@ -91,10 +89,8 @@ abstract class OptionsPropertyItem extends PropertyItem * Sets the text * * @param string $text text - * - * @return void */ - public function setText($text) + public function setText($text): void { $this->text = $text; } @@ -113,10 +109,8 @@ abstract class OptionsPropertyItem extends PropertyItem * Sets the force parameter * * @param string $force force parameter - * - * @return void */ - public function setForce($force) + public function setForce($force): void { $this->force = $force; } diff --git a/libraries/classes/Properties/Options/OptionsPropertyOneItem.php b/libraries/classes/Properties/Options/OptionsPropertyOneItem.php index bc5b9bb532..3e30bb3d9d 100644 --- a/libraries/classes/Properties/Options/OptionsPropertyOneItem.php +++ b/libraries/classes/Properties/Options/OptionsPropertyOneItem.php @@ -59,10 +59,8 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem * Sets the force parameter * * @param bool|string $force force parameter - * - * @return void */ - public function setForce($force) + public function setForce($force): void { $this->forceOne = $force; } @@ -81,10 +79,8 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem * Sets the values * * @param array $values values - * - * @return void */ - public function setValues(array $values) + public function setValues(array $values): void { $this->values = $values; } @@ -103,10 +99,8 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem * Sets the doc * * @param string|array $doc MySQL documentation pointer - * - * @return void */ - public function setDoc($doc) + public function setDoc($doc): void { $this->doc = $doc; } @@ -125,10 +119,8 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem * Sets the length * * @param int $len length - * - * @return void */ - public function setLen($len) + public function setLen($len): void { $this->len = $len; } @@ -147,10 +139,8 @@ abstract class OptionsPropertyOneItem extends OptionsPropertyItem * Sets the size * * @param int $size size - * - * @return void */ - public function setSize($size) + public function setSize($size): void { $this->size = $size; } diff --git a/libraries/classes/Properties/Plugins/PluginPropertyItem.php b/libraries/classes/Properties/Plugins/PluginPropertyItem.php index bac2c65ce8..1f1c9d9d32 100644 --- a/libraries/classes/Properties/Plugins/PluginPropertyItem.php +++ b/libraries/classes/Properties/Plugins/PluginPropertyItem.php @@ -64,10 +64,8 @@ abstract class PluginPropertyItem extends PropertyItem * Sets the text * * @param string $text text - * - * @return void */ - public function setText($text) + public function setText($text): void { $this->text = $text; } @@ -86,10 +84,8 @@ abstract class PluginPropertyItem extends PropertyItem * Sets the extension * * @param string $extension extension - * - * @return void */ - public function setExtension($extension) + public function setExtension($extension): void { $this->extension = $extension; } @@ -108,10 +104,8 @@ abstract class PluginPropertyItem extends PropertyItem * Sets the options * * @param OptionsPropertyRootGroup $options options - * - * @return void */ - public function setOptions($options) + public function setOptions($options): void { $this->options = $options; } @@ -130,10 +124,8 @@ abstract class PluginPropertyItem extends PropertyItem * Sets the options text * * @param string $optionsText optionsText - * - * @return void */ - public function setOptionsText($optionsText) + public function setOptionsText($optionsText): void { $this->optionsText = $optionsText; } @@ -152,10 +144,8 @@ abstract class PluginPropertyItem extends PropertyItem * Sets the MIME type * * @param string $mimeType MIME type - * - * @return void */ - public function setMimeType($mimeType) + public function setMimeType($mimeType): void { $this->mimeType = $mimeType; } diff --git a/libraries/classes/Relation.php b/libraries/classes/Relation.php index 7e80c1ee8f..0869cd9549 100644 --- a/libraries/classes/Relation.php +++ b/libraries/classes/Relation.php @@ -1135,11 +1135,9 @@ class Relation * @param string $username the username * @param string $sqlquery the sql query * - * @return void - * * @access public */ - public function setHistory($db, $table, $username, $sqlquery) + public function setHistory($db, $table, $username, $sqlquery): void { $maxCharactersInDisplayedSQL = $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']; // Prevent to run this automatically on Footer class destroying in testsuite @@ -1243,11 +1241,9 @@ class Relation * * @param string $username the username * - * @return void - * * @access public */ - public function purgeHistory($username) + public function purgeHistory($username): void { $cfgRelation = $this->getRelationsParam(); if (! $GLOBALS['cfg']['QueryHistoryDB'] || ! $cfgRelation['historywork']) { @@ -1635,10 +1631,8 @@ class Relation * @param string $table table name * @param string $field old field name * @param string $new_name new field name - * - * @return void */ - public function renameField($db, $table, $field, $new_name) + public function renameField($db, $table, $field, $new_name): void { $cfgRelation = $this->getRelationsParam(); @@ -1736,10 +1730,8 @@ class Relation * @param string $target_db Target database name * @param string $source_table Source table name * @param string $target_table Target table name - * - * @return void */ - public function renameTable($source_db, $target_db, $source_table, $target_table) + public function renameTable($source_db, $target_db, $source_table, $target_table): void { // Move old entries from PMA-DBs to new table if ($GLOBALS['cfgRelation']['commwork']) { @@ -2111,10 +2103,8 @@ class Relation * * @param string $db database * @param bool $create whether to create tables if they don't exist. - * - * @return void */ - public function fixPmaTables($db, $create = true) + public function fixPmaTables($db, $create = true): void { $tablesToFeatures = [ 'pma__bookmark' => 'bookmarktable', diff --git a/libraries/classes/RelationCleanup.php b/libraries/classes/RelationCleanup.php index d219580851..931bb7fe2a 100644 --- a/libraries/classes/RelationCleanup.php +++ b/libraries/classes/RelationCleanup.php @@ -34,10 +34,8 @@ class RelationCleanup * @param string $db database name * @param string $table table name * @param string $column column name - * - * @return void */ - public function column($db, $table, $column) + public function column($db, $table, $column): void { $cfgRelation = $this->relation->getRelationsParam(); @@ -97,10 +95,8 @@ class RelationCleanup * * @param string $db database name * @param string $table table name - * - * @return void */ - public function table($db, $table) + public function table($db, $table): void { $cfgRelation = $this->relation->getRelationsParam(); @@ -184,10 +180,8 @@ class RelationCleanup * Cleanup database related relation stuff * * @param string $db database name - * - * @return void */ - public function database($db) + public function database($db): void { $cfgRelation = $this->relation->getRelationsParam(); @@ -284,10 +278,8 @@ class RelationCleanup * Cleanup user related relation stuff * * @param string $username username - * - * @return void */ - public function user($username) + public function user($username): void { $cfgRelation = $this->relation->getRelationsParam(); diff --git a/libraries/classes/ResponseRenderer.php b/libraries/classes/ResponseRenderer.php index 26edf5aceb..23b24fa542 100644 --- a/libraries/classes/ResponseRenderer.php +++ b/libraries/classes/ResponseRenderer.php @@ -233,10 +233,8 @@ class ResponseRenderer /** * Disables the rendering of the header * and the footer in responses - * - * @return void */ - public function disable() + public function disable(): void { $this->header->disable(); $this->footer->disable(); @@ -413,10 +411,8 @@ class ResponseRenderer /** * Sends an HTML response to the browser - * - * @return void */ - public function response() + public function response(): void { $buffer = OutputBuffering::getInstance(); if (empty($this->HTML)) { @@ -437,10 +433,8 @@ class ResponseRenderer * Wrapper around PHP's header() function. * * @param string $text header string - * - * @return void */ - public function header($text) + public function header($text): void { // phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly \header($text); @@ -460,10 +454,8 @@ class ResponseRenderer * Wrapper around PHP's http_response_code() function. * * @param int $response_code will set the response code. - * - * @return void */ - public function httpResponseCode($response_code) + public function httpResponseCode($response_code): void { http_response_code($response_code); } @@ -494,10 +486,8 @@ class ResponseRenderer * Generate header for 303 * * @param string $location will set location to redirect. - * - * @return void */ - public function generateHeader303($location) + public function generateHeader303($location): void { $this->setHttpResponseCode(303); $this->header('Location: ' . $location); diff --git a/libraries/classes/Scripts.php b/libraries/classes/Scripts.php index 253a2199d0..753fbda0ab 100644 --- a/libraries/classes/Scripts.php +++ b/libraries/classes/Scripts.php @@ -51,13 +51,11 @@ class Scripts * * @param string $filename The name of the file to include * @param array $params Additional parameters to pass to the file - * - * @return void */ public function addFile( $filename, array $params = [] - ) { + ): void { $hash = md5($filename); if (! empty($this->files[$hash])) { return; @@ -75,10 +73,8 @@ class Scripts * Add new files to the list of scripts * * @param array $filelist The array of file names - * - * @return void */ - public function addFiles(array $filelist) + public function addFiles(array $filelist): void { foreach ($filelist as $filename) { $this->addFile($filename); @@ -112,10 +108,8 @@ class Scripts * Adds a new code snippet to the code to be executed * * @param string $code The JS code to be added - * - * @return void */ - public function addCode($code) + public function addCode($code): void { $this->code .= $code . "\n"; } diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index 71d68b830b..34dff64463 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -147,10 +147,8 @@ class Privileges * Parses privileges into an array, it modifies the array * * @param array $row Results row from - * - * @return void */ - public function fillInTablePrivileges(array &$row) + public function fillInTablePrivileges(array &$row): void { $row1 = $this->dbi->fetchSingleRow( 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', @@ -550,10 +548,8 @@ class Privileges * * @param string $username username * @param string $userGroup user group to set - * - * @return void */ - public function setUserGroup($username, $userGroup) + public function setUserGroup($username, $userGroup): void { $userGroup = $userGroup ?? ''; $cfgRelation = $this->relation->getRelationsParam(); @@ -2827,10 +2823,8 @@ class Privileges * the authentication plugin selected * * @param string $authPlugin authentication plugin selected - * - * @return void */ - public function setProperPasswordHashing($authPlugin) + public function setProperPasswordHashing($authPlugin): void { // Set the hashing method used by PASSWORD() // to be of type depending upon $authentication_plugin diff --git a/libraries/classes/Server/Status/Data.php b/libraries/classes/Server/Status/Data.php index da4a86db49..283f7b8ed2 100644 --- a/libraries/classes/Server/Status/Data.php +++ b/libraries/classes/Server/Status/Data.php @@ -73,10 +73,8 @@ class Data * * @param string $a key * @param mixed $b value - * - * @return void */ - public function __set($a, $b) + public function __set($a, $b): void { // Discard everything } diff --git a/libraries/classes/Session.php b/libraries/classes/Session.php index cfc49fd148..219d733148 100644 --- a/libraries/classes/Session.php +++ b/libraries/classes/Session.php @@ -39,10 +39,8 @@ class Session { /** * Generates PMA_token session variable. - * - * @return void */ - private static function generateToken() + private static function generateToken(): void { $_SESSION[' PMA_token '] = Util::generateRandom(16, true); $_SESSION[' HMAC_secret '] = Util::generateRandom(16); @@ -64,10 +62,8 @@ class Session * tries to secure session from hijacking and fixation * should be called before login and after successful login * (only required if sensitive information stored in session) - * - * @return void */ - public static function secure() + public static function secure(): void { // prevent session fixation and XSS if (session_status() === PHP_SESSION_ACTIVE) { @@ -83,10 +79,8 @@ class Session * Session failed function * * @param array $errors PhpMyAdmin\ErrorHandler array - * - * @return void */ - private static function sessionFailed(array $errors) + private static function sessionFailed(array $errors): void { $messages = []; foreach ($errors as $error) { @@ -128,10 +122,8 @@ class Session * * @param Config $config Configuration handler * @param ErrorHandler $errorHandler Error handler - * - * @return void */ - public static function setUp(Config $config, ErrorHandler $errorHandler) + public static function setUp(Config $config, ErrorHandler $errorHandler): void { // verify if PHP supports session, die if it does not if (! function_exists('session_name')) { diff --git a/libraries/classes/Setup/FormProcessing.php b/libraries/classes/Setup/FormProcessing.php index 141873be23..a3f5d2da66 100644 --- a/libraries/classes/Setup/FormProcessing.php +++ b/libraries/classes/Setup/FormProcessing.php @@ -23,10 +23,8 @@ class FormProcessing * Processes forms registered in $form_display, handles error correction * * @param FormDisplay $form_display Form to display - * - * @return void */ - public static function process(FormDisplay $form_display) + public static function process(FormDisplay $form_display): void { if (isset($_GET['mode']) && $_GET['mode'] === 'revert') { // revert erroneous fields to their default values diff --git a/libraries/classes/Setup/Index.php b/libraries/classes/Setup/Index.php index bb93135d37..8aed7f25af 100644 --- a/libraries/classes/Setup/Index.php +++ b/libraries/classes/Setup/Index.php @@ -26,10 +26,8 @@ class Index { /** * Initializes message list - * - * @return void */ - public static function messagesBegin() + public static function messagesBegin(): void { if (! isset($_SESSION['messages']) || ! is_array($_SESSION['messages'])) { $_SESSION['messages'] = [ @@ -54,10 +52,8 @@ class Index * @param string $msgId unique message identifier * @param string $title language string id (in $str array) * @param string $message message text - * - * @return void */ - public static function messagesSet($type, $msgId, $title, $message) + public static function messagesSet($type, $msgId, $title, $message): void { $fresh = ! isset($_SESSION['messages'][$type][$msgId]); $_SESSION['messages'][$type][$msgId] = [ @@ -70,10 +66,8 @@ class Index /** * Cleans up message list - * - * @return void */ - public static function messagesEnd() + public static function messagesEnd(): void { foreach ($_SESSION['messages'] as &$messages) { $remove_ids = []; @@ -116,10 +110,8 @@ class Index /** * Checks for newest phpMyAdmin version and sets result as a new notice - * - * @return void */ - public static function versionCheck() + public static function versionCheck(): void { // version check messages should always be visible so let's make // a unique message id each time we run it diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index 6b9e73ef5e..5b1ca34f20 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -83,15 +83,13 @@ class Sql * @param string $table table name * @param array $analyzedSqlResults the analyzed query results * @param string $fullSqlQuery SQL query - * - * @return void */ private function handleSortOrder( $db, $table, array &$analyzedSqlResults, &$fullSqlQuery - ) { + ): void { $tableObject = new Table($table, $db); if (empty($analyzedSqlResults['order'])) { @@ -579,10 +577,8 @@ class Sql * @param bool $isGotoFile whether goto file or not * @param string $error error after executing the query * @param string $fullSqlQuery full sql query - * - * @return void */ - private function handleQueryExecuteError($isGotoFile, $error, $fullSqlQuery) + private function handleQueryExecuteError($isGotoFile, $error, $fullSqlQuery): void { if ($isGotoFile) { $message = Message::rawError($error); @@ -604,8 +600,6 @@ class Sql * @param string $sqlQueryForBookmark the query to be stored in bookmark * @param string $bookmarkLabel bookmark label * @param bool $bookmarkReplace whether to replace existing bookmarks - * - * @return void */ public function storeTheQueryAsBookmark( $db, @@ -613,7 +607,7 @@ class Sql $sqlQueryForBookmark, $bookmarkLabel, bool $bookmarkReplace - ) { + ): void { $bfields = [ 'bkm_database' => $db, 'bkm_user' => $bookmarkUser, @@ -728,10 +722,8 @@ class Sql * @param string $table current table * @param string|null $column current column * @param bool $purge whether purge set or not - * - * @return void */ - private function cleanupRelations($db, $table, ?string $column, $purge) + private function cleanupRelations($db, $table, ?string $column, $purge): void { if (empty($purge) || strlen($db) <= 0) { return; @@ -972,10 +964,8 @@ class Sql * @param string $db current database * @param string $table current table * @param array $analyzedSqlResults analyzed sql results - * - * @return void */ - private function deleteTransformationInfo($db, $table, array $analyzedSqlResults) + private function deleteTransformationInfo($db, $table, array $analyzedSqlResults): void { if (! isset($analyzedSqlResults['statement'])) { return; diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index b23a69489d..bb4b24af4c 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -1992,10 +1992,8 @@ class Table implements Stringable * Loads the UI preferences for this table. * If pmadb and table_uiprefs is set, it will load the UI preferences from * phpMyAdmin database. - * - * @return void */ - protected function loadUiPrefs() + protected function loadUiPrefs(): void { $cfgRelation = $this->relation->getRelationsParam(); $serverId = $GLOBALS['server']; diff --git a/libraries/classes/Theme.php b/libraries/classes/Theme.php index 4418f29233..33769a3a9d 100644 --- a/libraries/classes/Theme.php +++ b/libraries/classes/Theme.php @@ -248,11 +248,9 @@ class Theme * * @param string $path path to theme * - * @return void - * * @access public */ - public function setPath($path) + public function setPath($path): void { $this->path = trim($path); } @@ -272,11 +270,9 @@ class Theme * * @param string $version version to set * - * @return void - * * @access public */ - public function setVersion($version) + public function setVersion($version): void { $this->version = trim($version); } @@ -313,11 +309,9 @@ class Theme * * @param string $name name to set * - * @return void - * * @access public */ - public function setName($name) + public function setName($name): void { $this->name = trim($name); } @@ -339,11 +333,9 @@ class Theme * * @param string $id new id * - * @return void - * * @access public */ - public function setId($id) + public function setId($id): void { $this->id = trim($id); } @@ -365,11 +357,9 @@ class Theme * * @param string $path path to images for this theme as an URL path * - * @return void - * * @access public */ - public function setImgPath($path) + public function setImgPath($path): void { $this->imgPath = $path; } diff --git a/libraries/classes/Tracker.php b/libraries/classes/Tracker.php index f382ef2187..e88079307a 100644 --- a/libraries/classes/Tracker.php +++ b/libraries/classes/Tracker.php @@ -835,11 +835,9 @@ class Tracker * * @param string $query a SQL query * - * @return void - * * @static */ - public static function handleQuery($query) + public static function handleQuery($query): void { global $dbi; diff --git a/libraries/classes/Tracking.php b/libraries/classes/Tracking.php index 4925f744c5..3385708e9d 100644 --- a/libraries/classes/Tracking.php +++ b/libraries/classes/Tracking.php @@ -853,10 +853,8 @@ class Tracking * Function to export as entries * * @param array $entries entries - * - * @return void */ - public function exportAsFileDownload(array $entries) + public function exportAsFileDownload(array $entries): void { ini_set('url_rewriter.tags', ''); @@ -1043,10 +1041,8 @@ class Tracking * Create tracking version for multiple tables * * @param array $selected list of selected tables - * - * @return void */ - public function createTrackingForMultipleTables(string $db, array $selected) + public function createTrackingForMultipleTables(string $db, array $selected): void { $tracking_set = $this->getTrackingSet(); diff --git a/libraries/classes/UserPassword.php b/libraries/classes/UserPassword.php index 05cc65973e..8dcc914147 100644 --- a/libraries/classes/UserPassword.php +++ b/libraries/classes/UserPassword.php @@ -153,8 +153,6 @@ class UserPassword * @param string $sql_query SQL query * @param string $hashing_function Hashing function * @param string $orig_auth_plugin Original Authentication Plugin - * - * @return void */ private function changePassUrlParamsAndSubmitQuery( $username, @@ -163,7 +161,7 @@ class UserPassword $sql_query, $hashing_function, $orig_auth_plugin - ) { + ): void { global $dbi; $err_url = Url::getFromRoute('/user-password'); diff --git a/libraries/classes/UserPreferences.php b/libraries/classes/UserPreferences.php index 7688261137..e7faa95f82 100644 --- a/libraries/classes/UserPreferences.php +++ b/libraries/classes/UserPreferences.php @@ -42,10 +42,8 @@ class UserPreferences * Common initialization for user preferences modification pages * * @param ConfigFile $cf Config file instance - * - * @return void */ - public function pageInit(ConfigFile $cf) + public function pageInit(ConfigFile $cf): void { $forms_all_keys = UserFormList::getFields(); $cf->resetConfigData(); // start with a clean instance @@ -247,14 +245,12 @@ class UserPreferences * @param string $file_name Filename * @param array|null $params URL parameters * @param string $hash Hash value - * - * @return void */ public function redirect( $file_name, $params = null, $hash = null - ) { + ): void { // redirect $url_params = ['saved' => 1]; if (is_array($params)) { diff --git a/libraries/services_loader.php b/libraries/services_loader.php index 6ac5410f07..c685c1c6f6 100644 --- a/libraries/services_loader.php +++ b/libraries/services_loader.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\Reference; use function is_string; use function substr; -return static function (ContainerConfigurator $configurator) { +return static function (ContainerConfigurator $configurator): void { $services = $configurator->services(); $loadServices = static function (array $servicesFile, ServicesConfigurator $services): void { foreach ($servicesFile['services'] as $serviceName => $service) { diff --git a/test/classes/Stubs/DbiDummy.php b/test/classes/Stubs/DbiDummy.php index 82632fa6cb..991f20665f 100644 --- a/test/classes/Stubs/DbiDummy.php +++ b/test/classes/Stubs/DbiDummy.php @@ -345,10 +345,8 @@ class DbiDummy implements DbiExtension * Frees memory associated with the result * * @param object $result database result - * - * @return void */ - public function freeResult($result) + public function freeResult($result): void { } @@ -568,10 +566,8 @@ class DbiDummy implements DbiExtension * @param string[] $columns The result columns * @param object[] $metadata The result metadata * @phpstan-param (int[]|string[]|array{string: string}|null[])[]|bool|bool[] $result - * - * @return void */ - public function addResult(string $query, $result, array $columns = [], array $metadata = []) + public function addResult(string $query, $result, array $columns = [], array $metadata = []): void { $this->filoQueries[] = [ 'query' => $query, diff --git a/test/classes/Stubs/ResponseRenderer.php b/test/classes/Stubs/ResponseRenderer.php index bdc4c1bce0..ccff98d148 100644 --- a/test/classes/Stubs/ResponseRenderer.php +++ b/test/classes/Stubs/ResponseRenderer.php @@ -135,10 +135,8 @@ class ResponseRenderer extends \PhpMyAdmin\ResponseRenderer /** * This function is used to clear all data to this * stub after any operations. - * - * @return void */ - public function clear() + public function clear(): void { $this->isSuccess = true; $this->json = []; |