Skip to content

Commit

Permalink
Improves typing in SMF\Config
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Stovell <[email protected]>
  • Loading branch information
Sesquipedalian committed Jul 1, 2024
1 parent 2439ebd commit 7563f51
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions Sources/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,51 +41,51 @@ class Config
* 1: Enable maintenance mode but allow admins to login normally.
* 2: Make the forum untouchable. You'll need to make it 0 again manually!
*/
public static $maintenance;
public static int $maintenance;
/**
* @var string
*
* Title for the maintenance mode message.
*/
public static $mtitle;
public static string $mtitle;
/**
* Description of why the forum is in maintenance mode.
*
* @var string
*/
public static $mmessage;
public static string $mmessage;

########## Forum info ##########
/**
* @var string
*
* The name of your forum.
*/
public static $mbname;
public static string $mbname;
/**
* @var string
*
* The default language file set for the forum.
*/
public static $language;
public static string $language;
/**
* @var string
*
* URL to your forum's folder. (without the trailing /!)
*/
public static $boardurl;
public static string $boardurl;
/**
* @var string
*
* Email address to send emails from. (like [email protected].)
*/
public static $webmaster_email;
public static string $webmaster_email;
/**
* @var string
*
* Name of the cookie to set for authentication.
*/
public static $cookiename;
public static string $cookiename;

########## Database info ##########
/**
Expand All @@ -94,76 +94,76 @@ class Config
* The database type.
* Default options: mysql, postgresql
*/
public static $db_type;
public static string $db_type;
/**
* @var int
*
* The database port.
* 0 to use default port for the database type.
*/
public static $db_port;
public static int $db_port;
/**
* @var string
*
* The server to connect to (or a Unix socket)
*/
public static $db_server;
public static string $db_server;
/**
* @var string
*
* The database name.
*/
public static $db_name;
public static string $db_name;
/**
* @var string
*
* Database username.
*/
public static $db_user;
public static string $db_user;
/**
* @var string
*
* Database password.
*/
public static $db_passwd;
public static string $db_passwd;
/**
* @var string
*
* Database user for when connecting with SSI.
*/
public static $ssi_db_user;
public static string $ssi_db_user;
/**
* @var string
*
* Database password for when connecting with SSI.
*/
public static $ssi_db_passwd;
public static string $ssi_db_passwd;
/**
* @var string
*
* A prefix to put in front of your table names.
* This helps to prevent conflicts.
*/
public static $db_prefix;
public static string $db_prefix;
/**
* @var bool
*
* Use a persistent database connection.
*/
public static $db_persist;
public static bool $db_persist;
/**
* @var bool
*
* Send emails on database connection error.
*/
public static $db_error_send;
public static bool $db_error_send;
/**
* @var null|bool
*
* Override the default behavior of the database layer for mb4 handling.
* null keep the default behavior untouched.
*/
public static $db_mb4;
public static ?bool $db_mb4;

########## Cache info ##########
/**
Expand All @@ -172,54 +172,54 @@ class Config
* Select a cache system. You should leave this up to the cache area of the
* admin panel for proper detection of the available options.
*/
public static $cache_accelerator;
public static string $cache_accelerator;
/**
* @var int
*
* The level at which you would like to cache.
* Between 0 (off) through 3 (cache a lot).
*/
public static $cache_enable;
public static int $cache_enable;
/**
* @var string
*
* This is only used for the memcache / memcached cache systems.
* Should be a string of 'server:port,server:port'
*/
public static $cache_memcached;
public static string $cache_memcached;
/**
* @var string
*
* Path to the cache directory for the file-based cache system.
*/
public static $cachedir;
public static string $cachedir;
/**
* @var string
*
* This is only used for the SQLite3 cache system.
* Path to the directory where the SQLite3 database file will be saved.
*/
public static $cachedir_sqlite;
public static string $cachedir_sqlite;

########## Image proxy ##########
/**
* @var bool
*
* Whether the proxy is enabled or not.
*/
public static $image_proxy_enabled;
public static bool $image_proxy_enabled;
/**
* @var string
*
* Secret key to be used by the proxy.
*/
public static $image_proxy_secret;
public static string $image_proxy_secret;
/**
* @var int
*
* Maximum file size (in KB) for individual files.
*/
public static $image_proxy_maxsize;
public static int $image_proxy_maxsize;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
Expand All @@ -228,77 +228,77 @@ class Config
*
* The absolute path to the forum's folder. (not just '.'!)
*/
public static $boarddir;
public static string $boarddir;
/**
* @var string
*
* Path to the Sources directory.
*/
public static $sourcedir;
public static string $sourcedir;
/**
* Path to the Packages directory.
*
* @var string
*/
public static $packagesdir;
public static string $packagesdir;
/**
* Path to the Packages directory.
*
* @var string
*/
public static $languagesdir;
public static string $languagesdir;
/**
* @var string
*
* Path to the tasks directory.
*/
public static $tasksdir;
public static string $tasksdir;

######### Legacy settings #########
/**
* @var string
*
* Database character set. Should always be utf8.
*/
public static $db_character_set;
public static string $db_character_set;

######### Developer settings #########
/**
* @var bool
*
* Whether to show debug info.
*/
public static $db_show_debug;
public static bool $db_show_debug;

/**
* @var string
* @var int
*
* Last database error.
*/
public static $db_last_error;
public static int $db_last_error;

######### Custom settings #########
/**
* @var array
*
* Holds any custom settings found in Settings.php.
*/
public static $custom = [];
public static array $custom = [];

######### Runtime configuration values #########
/**
* @var array
*
* Holds settings loaded from the settings table in the database.
*/
public static $modSettings = [];
public static array $modSettings = [];

/**
* @var string
*
* URL of SMF's main index.php. This is set in cleanRequest().
* URL of SMF's main index.php.
*/
public static $scripturl = null;
public static string $scripturl;

/****************************
* Internal static properties
Expand Down Expand Up @@ -352,7 +352,7 @@ class Config
* expression to decide where the replacement entry should be inserted.
* Note: 'replace_pattern' should be avoided unless ABSOLUTELY necessary.
*/
protected static $settings_defs = [
protected static array $settings_defs = [
[
'text' =>
"\n" .
Expand Down Expand Up @@ -824,17 +824,17 @@ class Config
* Authentication secret.
* This is protected in order to force access via Config::getAuthSecret()
*/
protected static $auth_secret;
protected static string $auth_secret;

/**
* @var string
*
* Path to a temporary directory.
*/
protected static $temp_dir;
protected static string $temp_dir;

/**
* @var string
* @var bool
*
* Tracks whether static variables and functions have been exported to
* global namespace.
Expand Down Expand Up @@ -979,7 +979,9 @@ public static function reloadModSettings(): void
Cache\CacheApi::load();

// Try to load it from the cache first; it'll never get cached if the setting is off.
if ((self::$modSettings = Cache\CacheApi::get('modSettings', 90)) == null) {
if (($temp = Cache\CacheApi::get('modSettings', 90)) !== null) {
self::$modSettings = $temp;
} else {
self::$modSettings = [];

$request = Db\DatabaseApi::$db->query(
Expand Down Expand Up @@ -2859,8 +2861,6 @@ public static function getTempDir(): string
/**
* Generate a random seed and ensure it's stored in settings.
*
* @todo Still referenced in Forum.php and ServerSideIncludes.php
*
* This only exists for backward compatibility with mods that might use the
* generated value.
*/
Expand Down

0 comments on commit 7563f51

Please sign in to comment.