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

Commit

Permalink
Replace null-coalesce with isset ternary statements
Browse files Browse the repository at this point in the history
Since we support PHP 5.6 still in this library, we cannot yet use null
coalesce.
  • Loading branch information
weierophinney committed Jul 9, 2018
1 parent bfcd041 commit 1172baf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/functions/normalize_uploaded_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ function normalizeUploadedFiles(array $files)
$tmpNameTree[$key],
$sizeTree[$key],
$errorTree[$key],
$nameTree[$key] ?? null,
$typeTree[$key] ?? null
isset($nameTree[$key]) ? $nameTree[$key] : null,
isset($typeTree[$key]) ? $typeTree[$key] : null
);
continue;
}
$normalized[$key] = createUploadedFile([
'tmp_name' => $tmpNameTree[$key],
'size' => $sizeTree[$key],
'error' => $errorTree[$key],
'name' => $nameTree[$key] ?? null,
'type' => $typeTree[$key] ?? null
'name' => isset($nameTree[$key]) ? $nameTree[$key] : null,
'type' => isset($typeTree[$key]) ? $typeTree[$key] : null
]);
}
return $normalized;
Expand Down Expand Up @@ -94,8 +94,8 @@ function normalizeUploadedFiles(array $files)
$files['tmp_name'],
$files['size'],
$files['error'],
$files['name'] ?? null,
$files['type'] ?? null
isset($files['name']) ? $files['name'] : null,
isset($files['type']) ? $files['type'] : null
);
};

Expand Down

0 comments on commit 1172baf

Please sign in to comment.