PHP 8.4 Implicitly marking parameter $... as nullable is deprecated

This commit is contained in:
the-djmaze 2026-10-27 16:24:54 +01:00
parent 28fc6f5e0f
commit 08bc097dd4
5 changed files with 11 additions and 17 deletions

View file

@ -30,12 +30,7 @@ class Http
return $oInstance;
}
/**
* @param mixed $mDefault = null
*
* @return mixed
*/
public static function GetServer(string $sKey, $mDefault = null)
public static function GetServer(string $sKey, mixed $mDefault = null): mixed
{
return isset($_SERVER[$sKey]) ? $_SERVER[$sKey] : $mDefault;
}

View file

@ -963,7 +963,7 @@ class Actions
*
* @return mixed
*/
public function GetActionParam(string $sKey, $mDefault = null)
public function GetActionParam(string $sKey, ?mixed $mDefault = null)
{
return isset($this->aCurrentActionParams[$sKey]) ?
$this->aCurrentActionParams[$sKey] : $mDefault;

View file

@ -76,7 +76,7 @@ abstract class Request
$this->stream = $stream;
}
public function setCABundleFile($file)
public function setCABundleFile(?string $file)
{
$this->ca_bundle = $file;
}
@ -87,7 +87,7 @@ abstract class Request
*
* @return bool
*/
public function canFetchURI($uri)
public function canFetchURI(string $uri)
{
if ('https:' === \substr($uri, 0, 6) && !$this->supportsSSL()) {
\trigger_error('HTTPS URI unsupported fetching '.$uri, E_USER_WARNING);
@ -111,7 +111,7 @@ abstract class Request
abstract protected function __doRequest(string &$method, string &$request_url, &$body, array $extra_headers) : Response;
public function doRequest($method, $request_url, /*string|array*/$body = null, array $extra_headers = array()) : ?Response
public function doRequest(string $method, string $request_url, string|array|null $body = null, array $extra_headers = array()) : ?Response
{
$method = \strtoupper($method);
$url = $request_url;
@ -157,12 +157,12 @@ abstract class Request
* Return whether a URI should be allowed. Override this method to conform to your local policy.
* By default, will attempt to fetch any http or https URI.
*/
public static function URIHasAllowedScheme($uri) : bool
public static function URIHasAllowedScheme(string $uri) : bool
{
return (bool) \preg_match('#^https?://#i', $uri);
}
public static function getSchemePort($scheme) : int
public static function getSchemePort(string $scheme) : int
{
return self::$scheme_ports[$scheme] ?? 0;
}

View file

@ -34,7 +34,9 @@ class Certificate
* A string having the format file://path/to/cert.pem; the named file must contain a PEM encoded certificate
* A string containing the content of a certificate, PEM encoded, may start with -----BEGIN CERTIFICATE-----
*/
function __construct($x509cert = null, $privateKey = null)
function __construct(\OpenSSLCertificate|string $x509cert = null,
#[\SensitiveParameter]
\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $privateKey = null)
{
if ($x509cert) {
$x509cert = \openssl_x509_read($x509cert);

View file

@ -18,10 +18,7 @@ class TAR
$this->alias = $alias ?: $filename;
}
/**
* @param $files array|string|null
*/
public function extractTo(string $directory, $files = null, bool $overwrite = false) : bool
public function extractTo(string $directory, array|string|null $files = null, bool $overwrite = false) : bool
{
$fp = \gzopen($this->filename, 'rb');
if (!$fp) {