From: Hypolite Petovan Date: Thu, 3 Nov 2022 00:38:23 +0000 (-0400) Subject: Deprecate default value parameters in Session and Config interfaces X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=23dda5d5105830a643271b2e9ff4f13c0c83abbe;p=friendica.git Deprecate default value parameters in Session and Config interfaces - It is more efficient to use the null coalescing operator ?? that prevents the computation of the default value if the key has been found --- diff --git a/src/Core/Config/Capability/IManageConfigValues.php b/src/Core/Config/Capability/IManageConfigValues.php index f18e8e1e3d..bf9144cf50 100644 --- a/src/Core/Config/Capability/IManageConfigValues.php +++ b/src/Core/Config/Capability/IManageConfigValues.php @@ -51,7 +51,7 @@ interface IManageConfigValues * * @param string $cat The category of the configuration value * @param string $key The configuration key to query - * @param mixed $default_value optional, The value to return if key is not set (default: null) + * @param mixed $default_value Deprecated, use `Config->get($cat, $key, null, $refresh) ?? $default_value` instead * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * * @return mixed Stored value or null if it does not exist diff --git a/src/Core/PConfig/Capability/IManagePersonalConfigValues.php b/src/Core/PConfig/Capability/IManagePersonalConfigValues.php index ead3c26147..191869daa8 100644 --- a/src/Core/PConfig/Capability/IManagePersonalConfigValues.php +++ b/src/Core/PConfig/Capability/IManagePersonalConfigValues.php @@ -51,7 +51,7 @@ interface IManagePersonalConfigValues * @param int $uid The user_id * @param string $cat The category of the configuration value * @param string $key The configuration key to query - * @param mixed $default_value optional, The value to return if key is not set (default: null) + * @param mixed $default_value Deprecated, use `PConfig->get($uid, $cat, $key, null, $refresh) ?? $default_value` instead * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * * @return mixed Stored value or null if it does not exist diff --git a/src/Core/Session/Capability/IHandleSessions.php b/src/Core/Session/Capability/IHandleSessions.php index d0b649845b..72905fc576 100644 --- a/src/Core/Session/Capability/IHandleSessions.php +++ b/src/Core/Session/Capability/IHandleSessions.php @@ -48,7 +48,7 @@ interface IHandleSessions * Handle the case where session_start() hasn't been called and the super global isn't available. * * @param string $name - * @param mixed $defaults + * @param mixed $defaults Deprecated, use `Session->get($name) ?? $defaults` instead * * @return mixed */ @@ -58,7 +58,7 @@ interface IHandleSessions * Retrieves a value from the provided key if it exists and removes it from session * * @param string $name - * @param mixed $defaults + * @param mixed $defaults Deprecated, use `Session->pop($name) ?? $defaults` instead * * @return mixed */