-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: FileCollection
#9040
refactor: FileCollection
#9040
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
* Populated the first time either files(), file(), or hasFile() | ||
* is called. | ||
* | ||
* @var array|null | ||
* @var array<string, list<UploadedFile>|UploadedFile>|null | ||
*/ | ||
protected $files; | ||
|
||
|
@@ -40,7 +40,7 @@ | |
* Each element in the array will be an instance of UploadedFile. | ||
* The key of each element will be the client filename. | ||
* | ||
* @return array|null | ||
* @return array<string, list<UploadedFile>|UploadedFile>|null | ||
*/ | ||
public function all() | ||
{ | ||
|
@@ -165,7 +165,7 @@ | |
* Given a file array, will create UploadedFile instances. Will | ||
* loop over an array and create objects for each. | ||
* | ||
* @return list<UploadedFile>|UploadedFile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you remove |
||
* @param array<string, int|string> $array File Object | ||
*/ | ||
protected function createFileObject(array $array) | ||
{ | ||
|
@@ -177,7 +177,7 @@ | |
continue; | ||
} | ||
|
||
$output[$key] = $this->createFileObject($values); | ||
Check failure on line 180 in system/HTTP/Files/FileCollection.php
|
||
} | ||
|
||
return $output; | ||
|
@@ -200,6 +200,10 @@ | |
* Thanks to Jack Sleight on the PHP Manual page for the basis | ||
* of this method. | ||
* | ||
* @param array<string, array<string, int|string>> $data $_FILES Array | ||
* | ||
* @return array<string, array<string, int|string>> | ||
* | ||
* @see http://php.net/manual/en/reserved.variables.files.php#118294 | ||
*/ | ||
protected function fixFilesArray(array $data): array | ||
|
@@ -218,7 +222,7 @@ | |
|
||
$stack = [&$pointer]; | ||
$iterator = new RecursiveIteratorIterator( | ||
new RecursiveArrayIterator($value), | ||
Check failure on line 225 in system/HTTP/Files/FileCollection.php
|
||
RecursiveIteratorIterator::SELF_FIRST | ||
); | ||
|
||
|
@@ -244,16 +248,16 @@ | |
/** | ||
* Navigate through an array looking for a particular index | ||
* | ||
* @param array $index The index sequence we are navigating down | ||
* @param array $value The portion of the array to process | ||
* @param list<string> $index The index sequence we are navigating down | ||
* @param array<string, mixed> $value The portion of the array to process | ||
* | ||
* @return list<UploadedFile>|UploadedFile|null | ||
*/ | ||
protected function getValueDotNotationSyntax(array $index, array $value) | ||
{ | ||
$currentIndex = array_shift($index); | ||
|
||
if (isset($currentIndex) && is_array($index) && $index && is_array($value[$currentIndex]) && $value[$currentIndex]) { | ||
if (isset($currentIndex) && $index !== [] && is_array($value[$currentIndex]) && $value[$currentIndex] !== []) { | ||
return $this->getValueDotNotationSyntax($index, $value[$currentIndex]); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.