Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 1172baf

Browse files
committed
Replace null-coalesce with isset ternary statements
Since we support PHP 5.6 still in this library, we cannot yet use null coalesce.
1 parent bfcd041 commit 1172baf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/functions/normalize_uploaded_files.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ function normalizeUploadedFiles(array $files)
4747
$tmpNameTree[$key],
4848
$sizeTree[$key],
4949
$errorTree[$key],
50-
$nameTree[$key] ?? null,
51-
$typeTree[$key] ?? null
50+
isset($nameTree[$key]) ? $nameTree[$key] : null,
51+
isset($typeTree[$key]) ? $typeTree[$key] : null
5252
);
5353
continue;
5454
}
5555
$normalized[$key] = createUploadedFile([
5656
'tmp_name' => $tmpNameTree[$key],
5757
'size' => $sizeTree[$key],
5858
'error' => $errorTree[$key],
59-
'name' => $nameTree[$key] ?? null,
60-
'type' => $typeTree[$key] ?? null
59+
'name' => isset($nameTree[$key]) ? $nameTree[$key] : null,
60+
'type' => isset($typeTree[$key]) ? $typeTree[$key] : null
6161
]);
6262
}
6363
return $normalized;
@@ -94,8 +94,8 @@ function normalizeUploadedFiles(array $files)
9494
$files['tmp_name'],
9595
$files['size'],
9696
$files['error'],
97-
$files['name'] ?? null,
98-
$files['type'] ?? null
97+
isset($files['name']) ? $files['name'] : null,
98+
isset($files['type']) ? $files['type'] : null
9999
);
100100
};
101101

0 commit comments

Comments
 (0)