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

Commit bfe7a22

Browse files
mattsahweierophinney
authored andcommitted
Making UploadedFile extend SplFileInfo
1 parent 8db5e63 commit bfe7a22

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/UploadedFile.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Zend\Diactoros;
1111

12+
use SplFileInfo;
1213
use Psr\Http\Message\StreamInterface;
1314
use Psr\Http\Message\UploadedFileInterface;
1415

@@ -35,7 +36,7 @@
3536
use const UPLOAD_ERR_OK;
3637
use const UPLOAD_ERR_PARTIAL;
3738

38-
class UploadedFile implements UploadedFileInterface
39+
class UploadedFile extends SplFileInfo implements UploadedFileInterface
3940
{
4041
const ERROR_MESSAGES = [
4142
UPLOAD_ERR_OK => 'There is no error, the file uploaded with success',
@@ -102,9 +103,13 @@ public function __construct(
102103
if ($errorStatus === UPLOAD_ERR_OK) {
103104
if (is_string($streamOrFile)) {
104105
$this->file = $streamOrFile;
106+
107+
parent::__construct($this->file);
105108
}
106109
if (is_resource($streamOrFile)) {
107110
$this->stream = new Stream($streamOrFile);
111+
112+
parent::__construct($this->stream->getMetaData('uri'));
108113
}
109114

110115
if (! $this->file && ! $this->stream) {

0 commit comments

Comments
 (0)