From a81656c3ed5b8fe0f31794a4fbe0d1a907fca8e8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 6 Sep 2024 09:06:46 +0200 Subject: Upgrade to PHP 8.1 (#6711) * Upgrade to PHP 8.1 As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474 https://www.php.net/releases/8.0/en.php https://www.php.net/releases/8.1/en.php Upgrade to available native type declarations https://php.net/language.types.declarations Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore) Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22. * Include 6736 https://github.com/FreshRSS/FreshRSS/pull/6736 --- lib/Minz/Configuration.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/Minz/Configuration.php') diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 7205f3009..89aea4fae 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -56,10 +56,9 @@ class Minz_Configuration { * Return the configuration related to a given namespace. * * @param string $namespace the name of the configuration to get. - * @return static object * @throws Minz_ConfigurationNamespaceException if the namespace does not exist. */ - public static function get(string $namespace) { + public static function get(string $namespace): static { if (!isset(self::$config_list[$namespace])) { throw new Minz_ConfigurationNamespaceException( $namespace . ' namespace does not exist' @@ -156,7 +155,7 @@ class Minz_Configuration { * @param mixed $default default value to return if key does not exist. * @return array|mixed value corresponding to the key. */ - public function param(string $key, $default = null) { + public function param(string $key, mixed $default = null): mixed { if (isset($this->data[$key])) { return $this->data[$key]; } elseif (!is_null($default)) { @@ -171,7 +170,7 @@ class Minz_Configuration { * A wrapper for param(). * @return array|mixed */ - public function __get(string $key) { + public function __get(string $key): mixed { return $this->param($key); } @@ -181,7 +180,7 @@ class Minz_Configuration { * @param string $key the param name to set. * @param mixed $value the value to set. If null, the key is removed from the configuration. */ - public function _param(string $key, $value = null): void { + public function _param(string $key, mixed $value = null): void { if ($this->configuration_setter !== null && $this->configuration_setter->support($key)) { $this->configuration_setter->handle($this->data, $key, $value); } elseif (isset($this->data[$key]) && is_null($value)) { @@ -193,9 +192,8 @@ class Minz_Configuration { /** * A wrapper for _param(). - * @param mixed $value */ - public function __set(string $key, $value): void { + public function __set(string $key, mixed $value): void { $this->_param($key, $value); } -- cgit v1.2.3