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

Commit

Permalink
Merge branch 'improvement/368'
Browse files Browse the repository at this point in the history
Close #368
  • Loading branch information
michalbundyra committed Sep 1, 2019
2 parents ff581e3 + eee8d7e commit 7686720
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/functions/create_uploaded_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function createUploadedFile(array $spec) : UploadedFile
$spec['tmp_name'],
$spec['size'],
$spec['error'],
isset($spec['name']) ? $spec['name'] : null,
isset($spec['type']) ? $spec['type'] : null
$spec['name'] ?? null,
$spec['type'] ?? null
);
}
2 changes: 1 addition & 1 deletion src/functions/marshal_method_from_sapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
*/
function marshalMethodFromSapi(array $server) : string
{
return isset($server['REQUEST_METHOD']) ? $server['REQUEST_METHOD'] : 'GET';
return $server['REQUEST_METHOD'] ?? 'GET';
}
8 changes: 4 additions & 4 deletions src/functions/marshal_uri_from_sapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,19 @@ function marshalUriFromSapi(array $server, array $headers) : Uri
$marshalRequestPath = function (array $server) : string {
// IIS7 with URL Rewrite: make sure we get the unencoded url
// (double slash problem).
$iisUrlRewritten = array_key_exists('IIS_WasUrlRewritten', $server) ? $server['IIS_WasUrlRewritten'] : null;
$unencodedUrl = array_key_exists('UNENCODED_URL', $server) ? $server['UNENCODED_URL'] : '';
$iisUrlRewritten = $server['IIS_WasUrlRewritten'] ?? null;
$unencodedUrl = $server['UNENCODED_URL'] ?? '';
if ('1' === $iisUrlRewritten && ! empty($unencodedUrl)) {
return $unencodedUrl;
}

$requestUri = array_key_exists('REQUEST_URI', $server) ? $server['REQUEST_URI'] : null;
$requestUri = $server['REQUEST_URI'] ?? null;

if ($requestUri !== null) {
return preg_replace('#^[^/:]+://[^/]+#', '', $requestUri);
}

$origPathInfo = array_key_exists('ORIG_PATH_INFO', $server) ? $server['ORIG_PATH_INFO'] : null;
$origPathInfo = $server['ORIG_PATH_INFO'] ?? null;
if (empty($origPathInfo)) {
return '/';
}
Expand Down
12 changes: 6 additions & 6 deletions src/functions/normalize_uploaded_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ function normalizeUploadedFiles(array $files) : array
$tmpNameTree[$key],
$sizeTree[$key],
$errorTree[$key],
isset($nameTree[$key]) ? $nameTree[$key] : null,
isset($typeTree[$key]) ? $typeTree[$key] : null
$nameTree[$key] ?? null,
$typeTree[$key] ?? null
);
continue;
}
$normalized[$key] = createUploadedFile([
'tmp_name' => $tmpNameTree[$key],
'size' => $sizeTree[$key],
'error' => $errorTree[$key],
'name' => isset($nameTree[$key]) ? $nameTree[$key] : null,
'type' => isset($typeTree[$key]) ? $typeTree[$key] : null
'name' => $nameTree[$key] ?? null,
'type' => $typeTree[$key] ?? null,
]);
}
return $normalized;
Expand Down Expand Up @@ -96,8 +96,8 @@ function normalizeUploadedFiles(array $files) : array
$files['tmp_name'],
$files['size'],
$files['error'],
isset($files['name']) ? $files['name'] : null,
isset($files['type']) ? $files['type'] : null
$files['name'] ?? null,
$files['type'] ?? null
);
};

Expand Down

0 comments on commit 7686720

Please sign in to comment.