From: Roland Häder Date: Sun, 19 Jun 2022 08:49:26 +0000 (+0200) Subject: Changes: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=60f8c2d795dcf6c7cc592d3d6d3d6587a892f6c1;p=friendica.git Changes: - added missing type-hints - added documentation for a method --- diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index f1ed26b4be..3c82986fa9 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -492,8 +492,7 @@ class DBStructure } - $sql = sprintf("%s INDEX `%s` (%s)", $method, DBA::escape($indexName), $names); - return ($sql); + return sprintf("%s INDEX `%s` (%s)", $method, DBA::escape($indexName), $names); } /** @@ -515,7 +514,7 @@ class DBStructure * @return string Empty string if the update is successful, error messages otherwise * @throws Exception */ - public static function performUpdate(bool $enable_maintenance_mode = true, bool $verbose = false) + public static function performUpdate(bool $enable_maintenance_mode = true, bool $verbose = false): string { if ($enable_maintenance_mode) { DI::config()->set('system', 'maintenance', 1); @@ -539,7 +538,7 @@ class DBStructure * @return string Empty string if the update is successful, error messages otherwise * @throws Exception */ - public static function install(string $basePath) + public static function install(string $basePath): string { return self::update($basePath, false, true, true); } @@ -556,7 +555,7 @@ class DBStructure * @return string Empty string if the update is successful, error messages otherwise * @throws Exception */ - private static function update($basePath, $verbose, $action, $install = false, array $tables = null, array $definition = null) + private static function update(string $basePath, bool $verbose, bool $action, bool $install = false, array $tables = null, array $definition = null): string { $in_maintenance_mode = DI::config()->get('system', 'maintenance'); @@ -841,7 +840,13 @@ class DBStructure return $errors; } - private static function tableStructure($table) + /** + * Returns an array with table structure information + * + * @param string $table Name of table + * @return array Table structure information + */ + private static function tableStructure(string $table): array { // This query doesn't seem to be executable as a prepared statement $indexes = DBA::toArray(DBA::p("SHOW INDEX FROM " . DBA::quoteIdentifier($table)));