1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/17281] Update psalm config and fix issues

PHPBB3-17281
This commit is contained in:
Marc Alexander
2023-12-30 17:41:12 +01:00
parent c6c299eea4
commit 661a8a6117
42 changed files with 107 additions and 80 deletions

View File

@@ -27,7 +27,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
/**
* Creates a configuration container with a default set of values
*
* @param array<string,string> $config The configuration data.
* @param array<string,int|string> $config The configuration data.
*/
public function __construct(array $config)
{
@@ -74,22 +74,22 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
* The configuration change will not persist. It will be lost
* after the request.
*
* @param string $key The configuration option's name.
* @param string $value The temporary value.
* @param string $offset The configuration option's name.
* @param int|string $value The temporary value.
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
public function offsetSet($offset, $value)
{
$this->config[$key] = $value;
$this->config[$offset] = $value;
}
/**
* Called when deleting a configuration value directly, triggers an error.
*
* @param string $key The configuration option's name.
* @param string $offset The configuration option's name.
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
public function offsetUnset($offset): never
{
trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR);
}
@@ -121,7 +121,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
* Sets a configuration option's value
*
* @param string $key The configuration option's name
* @param string $value New configuration value
* @param int|string $value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
@@ -135,8 +135,8 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
* current configuration value or the configuration value does not exist yet.
*
* @param string $key The configuration option's name
* @param string $old_value Current configuration value
* @param string $new_value New configuration value
* @param int|string $old_value Current configuration value
* @param int|string $new_value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
* @return bool True if the value was changed, false otherwise.
@@ -157,7 +157,7 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable
* only after set_atomic has been called.
*
* @param string $key The configuration option's name
* @param string $new_value New configuration value
* @param int|string $new_value New configuration value
* @throws \phpbb\exception\http_exception when config value is set and not equal to new_value.
* @return bool True if the value was changed, false otherwise.
*/

View File

@@ -127,10 +127,10 @@ class db extends config
/**
* Sets a configuration option's value
*
* @param string $key The configuration option's name
* @param string $value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
* @param string $key The configuration option's name
* @param int|string $value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
public function set($key, $value, $use_cache = true)
{
@@ -141,13 +141,13 @@ class db extends config
* Sets a configuration option's value only if the old_value matches the
* current configuration value or the configuration value does not exist yet.
*
* @param string $key The configuration option's name
* @param mixed $old_value Current configuration value or false to ignore
* the old value
* @param string $new_value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached
* @return bool True if the value was changed, false otherwise
* @param string $key The configuration option's name
* @param false|int|string $old_value Current configuration value or false to ignore
* the old value
* @param int|string $new_value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached
* @return bool True if the value was changed, false otherwise
*/
public function set_atomic($key, $old_value, $new_value, $use_cache = true)
{