Deprecated: Creation of dynamic property PHPMailerPHPMailerPHPMailer::$port is deprecated

I’m trying to send an email via PHPMailer.

My local development environment:

OS Windows 11 Pro
XAMPP with PHP 8.2.12
PHPMailer Version 6.9.1

The code looks like this:

      try {
        $phpMailer = new PHPMailer(true);
          
        $phpMailer->CharSet = $this->charSet;

        // server settings
        $phpMailer->isSMTP();
        $phpMailer->Host       = $this->mailHost;
        $phpMailer->SMTPAuth   = true;
        $phpMailer->Username   = $this->mailUser;
        $phpMailer->Password   = $this->mailPwd;
        $phpMailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $phpMailer->port       = $this->mailPort; // is set to 587
          
            // recipients
        $phpMailer->setFrom($this->from, 'test.test');
        $phpMailer->addAddress($addressMail);

        // content
        $phpMailer->isHTML($this->isHtml);
        $phpMailer->Subject = $this->subject;
        $phpMailer->Body    = $this->body;
          
        // add attachments
        if (!empty($attachments) && $addAttachment) {
          for ($i = 0; $i < count($attachments["filePaths"]); $i++) {
            if ( count($attachments["filePaths"]) > 0
              && array_key_exists( $i, $attachments["fileNames"])) {
              $phpMailer->AddAttachment($attachments["filePaths"][$i], $attachments["fileNames"][$i]);
            }
          }
        }

        $returnValue = $phpMailer->send();
      } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$phpMailer->ErrorInfo}";
      }

However, I get the message:
Deprecated: Creation of dynamic property PHPMailerPHPMailerPHPMailer::$port is deprecated

What is the reason for this?

Am I maybe using the wrong version (upgrade PHPMailer)?

I tried to switch the sending to SMTP, but my server does not support it and therefore no mails are sent.

With port 465 and TLS mails are sent, but I get the info that the port is outdated.