Replace deprecated calls to defaults() by ?? and ?: in src/

This commit is contained in:
Hypolite Petovan 2019-10-16 08:35:14 -04:00
parent c0b78a9720
commit 146646c4d4
41 changed files with 239 additions and 233 deletions

View file

@ -57,7 +57,7 @@ class Emailer
.rand(10000, 99999);
// generate a multipart/alternative message header
$messageHeader = defaults($params, 'additionalMailHeader', '') .
$messageHeader = ($params['additionalMailHeader'] ?? '') .
"From: $fromName <{$params['fromEmail']}>\n" .
"Reply-To: $fromName <{$params['replyTo']}>\n" .
"MIME-Version: 1.0\n" .

View file

@ -104,7 +104,7 @@ class Network
$parts2 = [];
$parts = parse_url($url);
$path_parts = explode('/', defaults($parts, 'path', ''));
$path_parts = explode('/', $parts['path'] ?? '');
foreach ($path_parts as $part) {
if (strlen($part) <> mb_strlen($part)) {
$parts2[] = rawurlencode($part);
@ -801,8 +801,8 @@ class Network
$i = 0;
$path = "";
do {
$path1 = defaults($pathparts1, $i, '');
$path2 = defaults($pathparts2, $i, '');
$path1 = $pathparts1[$i] ?? '';
$path2 = $pathparts2[$i] ?? '';
if ($path1 == $path2) {
$path .= $path1."/";

View file

@ -141,7 +141,7 @@ class ParseUrl
}
// If the file is too large then exit
if (defaults($curlResult->getInfo(), 'download_content_length', 0) > 1000000) {
if (($curlResult->getInfo()['download_content_length'] ?? 0) > 1000000) {
return $siteinfo;
}

View file

@ -79,7 +79,7 @@ class Profiler implements ContainerInterface
return;
}
$duration = (float) (microtime(true) - $timestamp);
$duration = floatval(microtime(true) - $timestamp);
if (!isset($this->performance[$value])) {
// Prevent ugly E_NOTICE