package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -31,19 +31,13 @@ class FileBag extends ParameterBag
$this->replace($parameters);
}
/**
* {@inheritdoc}
*/
public function replace(array $files = [])
{
$this->parameters = [];
$this->add($files);
}
/**
* {@inheritdoc}
*/
public function set(string $key, $value)
public function set(string $key, mixed $value)
{
if (!\is_array($value) && !$value instanceof UploadedFile) {
throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.');
@@ -52,9 +46,6 @@ class FileBag extends ParameterBag
parent::set($key, $this->convertFileInformation($value));
}
/**
* {@inheritdoc}
*/
public function add(array $files = [])
{
foreach ($files as $key => $file) {
@@ -65,11 +56,9 @@ class FileBag extends ParameterBag
/**
* Converts uploaded files to UploadedFile instances.
*
* @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information
*
* @return UploadedFile[]|UploadedFile|null
*/
protected function convertFileInformation($file)
protected function convertFileInformation(array|UploadedFile $file): array|UploadedFile|null
{
if ($file instanceof UploadedFile) {
return $file;
@@ -106,10 +95,8 @@ class FileBag extends ParameterBag
*
* It's safe to pass an already converted array, in which case this method
* just returns the original array unmodified.
*
* @return array
*/
protected function fixPhpFilesArray(array $data)
protected function fixPhpFilesArray(array $data): array
{
// Remove extra key added by PHP 8.1.
unset($data['full_path']);