Use a PSR-7 stream in DebugEmailTransport
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Oct 2022 14:19:50 +0000 (16:19 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Oct 2022 14:19:50 +0000 (16:19 +0200)
wcfsetup/install/files/lib/system/email/transport/DebugEmailTransport.class.php

index bf97014beaa176726c071b3286a94cb76f90ce21..d4e066a2f53a2a69758a484896527184eb36da96 100644 (file)
@@ -2,9 +2,10 @@
 
 namespace wcf\system\email\transport;
 
+use Laminas\Diactoros\Stream;
+use Psr\Http\Message\StreamInterface;
 use wcf\system\email\Email;
 use wcf\system\email\Mailbox;
-use wcf\system\io\File;
 use wcf\util\DateUtil;
 
 /**
@@ -19,32 +20,24 @@ use wcf\util\DateUtil;
  */
 final class DebugEmailTransport implements IEmailTransport
 {
-    /**
-     * mbox file
-     * @var File
-     */
-    protected $mbox;
+    protected StreamInterface $mbox;
 
     /**
      * Creates a new DebugTransport using the given mbox as target.
      *
-     * @param string $mbox mbox location or null for default location
+     * @param $mbox mbox location or null for default location
      */
-    public function __construct($mbox = null)
+    public function __construct(?string $mbox = null)
     {
         if ($mbox === null) {
             $mbox = WCF_DIR . 'log/debug.mbox';
         }
 
-        $this->mbox = new File($mbox, 'ab');
+        $this->mbox = new Stream($mbox, 'ab');
     }
 
     /**
      * Writes the given $email into the mbox.
-     *
-     * @param Email $email
-     * @param Mailbox $envelopeFrom
-     * @param Mailbox $envelopeTo
      */
     public function deliver(Email $email, Mailbox $envelopeFrom, Mailbox $envelopeTo)
     {