diff --git a/docs/book/v2/api.md b/docs/book/v2/api.md index 7dd3b2f6..a37cfb46 100644 --- a/docs/book/v2/api.md +++ b/docs/book/v2/api.md @@ -194,6 +194,4 @@ In most cases, you will not interact with the Stream object directly. and provides abstraction around a single uploaded file, including behavior for interacting with it as a stream or moving it to a filesystem location. -Additionally, it extends PHP's build in `SplFileInfo` object in order to provide a compatible interface wherever such an object is needed. - In most cases, you will only use the methods defined in the `UploadedFileInterface`. diff --git a/src/UploadedFile.php b/src/UploadedFile.php index a28b7af5..2f4d87f1 100644 --- a/src/UploadedFile.php +++ b/src/UploadedFile.php @@ -9,7 +9,6 @@ namespace Zend\Diactoros; -use SplFileInfo; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UploadedFileInterface; @@ -36,7 +35,7 @@ use const UPLOAD_ERR_OK; use const UPLOAD_ERR_PARTIAL; -class UploadedFile extends SplFileInfo implements UploadedFileInterface +class UploadedFile implements UploadedFileInterface { const ERROR_MESSAGES = [ UPLOAD_ERR_OK => 'There is no error, the file uploaded with success', @@ -103,13 +102,9 @@ public function __construct( if ($errorStatus === UPLOAD_ERR_OK) { if (is_string($streamOrFile)) { $this->file = $streamOrFile; - - parent::__construct($this->file); } if (is_resource($streamOrFile)) { $this->stream = new Stream($streamOrFile); - - parent::__construct($this->stream->getMetaData('uri')); } if (! $this->file && ! $this->stream) { diff --git a/test/UploadedFileTest.php b/test/UploadedFileTest.php index 80e90eb8..35ab5edb 100644 --- a/test/UploadedFileTest.php +++ b/test/UploadedFileTest.php @@ -13,7 +13,6 @@ use PHPUnit\Framework\TestCase; use ReflectionProperty; use RuntimeException; -use SplFileInfo; use Zend\Diactoros\Stream; use Zend\Diactoros\UploadedFile; @@ -326,13 +325,4 @@ public function testMoveToRaisesExceptionWithAppropriateMessageWhenUploadErrorDe $this->expectExceptionMessage($message); $uploadedFile->moveTo('/tmp/foo'); } - - /** - * @see https://github.com/zendframework/zend-diactoros/pull/378 - */ - public function testExtendsSplFileInfo() - { - $uploaded = new UploadedFile(fopen('php://temp', 'wb+'), 0, UPLOAD_ERR_OK); - $this->assertInstanceOf(SplFileInfo::class, $uploaded); - } }