Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Declare compatible with Flow 9.x #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Classes/Command/EmailCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class EmailCommandController extends CommandController
* @param string $to The to address of the message
* @param string $subject The subject of the message
* @param string $body The body of the message
* @param string $contentType The body content type of the message (Default: test/plain)
* @param string $contentType The body content type of the message (Default: text/plain)
* @param string $charset The body charset of the message (Default: UTF8)
*/
public function sendCommand(string $from, string $to, string $subject, string $body = '', string $contentType = 'text/plain', $charset = 'UTF8'): void
public function sendCommand(string $from, string $to, string $subject, string $body = '', string $contentType = 'text/plain', string $charset = 'UTF8'): void
{
$message = (new Message())
->setFrom($from)
Expand Down
2 changes: 2 additions & 0 deletions Classes/Mailer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
declare(strict_types=1);

namespace Neos\SwiftMailer;

/*
Expand Down
11 changes: 1 addition & 10 deletions Classes/MailerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,16 @@ interface MailerInterface
*
* The return value is the number of recipients who were accepted for
* delivery.
*
* @param \Swift_Mime_SimpleMessage $message
* @param array $failedRecipients An array of failures by-reference
* @return int
*/
public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = null);
public function send(\Swift_Mime_SimpleMessage $message, array &$failedRecipients = null);

/**
* Register a plugin using a known unique key (e.g. myPlugin).
*
* @param \Swift_Events_EventListener $plugin
* @return void
*/
public function registerPlugin(\Swift_Events_EventListener $plugin);

/**
* The Transport used to send messages.
*
* @return \Swift_Transport
*/
public function getTransport();
}
15 changes: 3 additions & 12 deletions Classes/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,18 @@ class Message extends \Swift_Message
{
/**
* @Flow\Inject
* @var \Neos\SwiftMailer\MailerInterface
*/
protected $mailer;
protected MailerInterface $mailer;

/**
* True if the message has been sent.
*
* @var bool
*/
protected $sent = false;
protected bool $sent = false;

/**
* Holds the failed recipients after the message has been sent
*
* @var array
*/
protected $failedRecipients = [];
protected array $failedRecipients = [];

/**
* Sends the message.
Expand All @@ -57,8 +52,6 @@ public function send(): int

/**
* Checks whether the message has been sent.
*
* @return bool
*/
public function isSent(): bool
{
Expand All @@ -67,8 +60,6 @@ public function isSent(): bool

/**
* Returns the recipients for which the mail was not accepted for delivery.
*
* @return array the recipients who were not accepted for delivery
*/
public function getFailedRecipients(): array
{
Expand Down
28 changes: 3 additions & 25 deletions Classes/Transport/LoggingTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,16 @@ class LoggingTransport implements TransportInterface
{
/**
* Store sent messages for testing
*
* @var array
*/
protected static $deliveredMessages = [];
protected static array $deliveredMessages = [];

/**
* @Flow\Inject
* @var LoggerInterface
*/
protected $logger;
protected LoggerInterface $logger;

/**
* The logging transport is always started
*
* @return bool Always true for this transport
*/
public function isStarted(): bool
{
Expand All @@ -49,17 +44,13 @@ public function isStarted(): bool

/**
* No op
*
* @return void
*/
public function start(): void
{
}

/**
* No op
*
* @return void
*/
public function stop(): void
{
Expand All @@ -68,10 +59,6 @@ public function stop(): void
/**
* "Send" the given Message. This transport will add it to a stored collection of sent messages
* for testing purposes and log the message to the system logger.
*
* @param \Swift_Mime_SimpleMessage $message The message to send
* @param array &$failedRecipients Failed recipients
* @return int
*/
public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = null): int
{
Expand Down Expand Up @@ -106,18 +93,13 @@ protected function buildStringFromEmailAndNameArray(array $addresses): string

/**
* No op
*
* @param \Swift_Events_EventListener $plugin
* @return void
*/
public function registerPlugin(\Swift_Events_EventListener $plugin): void
{
}

/**
* Get delivered messages that were sent through this transport
*
* @return array
*/
public static function getDeliveredMessages(): array
{
Expand All @@ -126,18 +108,14 @@ public static function getDeliveredMessages(): array

/**
* Reset the delivered messages (e.g. for tearDown in functional test)
*
* @return void
*/
public static function reset(): void
{
self::$deliveredMessages = [];
}

/**
* Check if this Transport mechanism is alive.
*
* @return bool Always true for this transport
* This Transport mechanism is always alive.
*/
public function ping(): bool
{
Expand Down
29 changes: 4 additions & 25 deletions Classes/Transport/MboxTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
class MboxTransport implements TransportInterface
{
/**
* @var string The file to write the mails into
* The file to write the mails into
*/
protected $mboxPathAndFilename;
protected string $mboxPathAndFilename;

/**
* Set path and filename of mbox file to use.
*
* @param string $mboxPathAndFilename
* @return void
*/
public function setMboxPathAndFilename(string $mboxPathAndFilename): void
{
Expand All @@ -41,8 +38,6 @@ public function setMboxPathAndFilename(string $mboxPathAndFilename): void

/**
* The mbox transport is always started
*
* @return boolean Always TRUE for this transport
*/
public function isStarted(): bool
{
Expand All @@ -51,30 +46,22 @@ public function isStarted(): bool

/**
* No op
*
* @return void
*/
public function start(): void
{
}

/**
* No op
*
* @return void
*/
public function stop(): void
{
}

/**
* Outputs the mail to a text file according to RFC 4155.
*
* @param \Swift_Mime_SimpleMessage $message The message to send
* @param array &$failedRecipients Failed recipients (no failures in this transport)
* @return int
*/
public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = null): int
{
$message->generateId();

Expand All @@ -96,9 +83,6 @@ public function send(\Swift_Mime_SimpleMessage $message, &$failedRecipients = nu

/**
* Determine the best-use reverse path for this message
*
* @param \Swift_Mime_SimpleMessage $message
* @return string|null
*/
private function getReversePath(\Swift_Mime_SimpleMessage $message): string
{
Expand All @@ -123,18 +107,13 @@ private function getReversePath(\Swift_Mime_SimpleMessage $message): string

/**
* No op
*
* @param \Swift_Events_EventListener $plugin
* @return void
*/
public function registerPlugin(\Swift_Events_EventListener $plugin): void
{
}

/**
* Check if this Transport mechanism is alive.
*
* @return bool Always true for this transport
* This Transport mechanism is always alive.
*/
public function ping(): bool
{
Expand Down
10 changes: 3 additions & 7 deletions Classes/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@ class TransportFactory
/**
* Factory method which creates the specified transport with the given options.
*
* @param string $transportType Object name of the transport to create
* @param array $transportOptions Options for the transport
* @param array $transportArguments Constructor arguments for the transport
* @return \Swift_Transport The created transport instance
* @throws Exception
* @throws \ReflectionException
*/
public function create(string $transportType, array $transportOptions = [], array $transportArguments = null): \Swift_Transport
public function create(string $transportType, array $transportOptions = [], array $transportConstructorArguments = null): \Swift_Transport
{
if (!class_exists($transportType)) {
throw new Exception(sprintf('The specified transport backend "%s" does not exist.', $transportType), 1269351207);
}

if (is_array($transportArguments)) {
if (is_array($transportConstructorArguments)) {
$class = new \ReflectionClass($transportType);
$transport = $class->newInstanceArgs($transportArguments);
$transport = $class->newInstanceArgs($transportConstructorArguments);
} else {
$transport = new $transportType();
}
Expand Down
5 changes: 3 additions & 2 deletions Migrations/Code/Version20161130105617.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace Neos\Flow\Core\Migrations;

Expand All @@ -17,15 +18,15 @@
*/
class Version20161130105617 extends AbstractMigration
{
public function getIdentifier()
public function getIdentifier(): string
{
return 'Neos.SwiftMailer-20161130105617';
}

/**
* @return void
*/
public function up()
public function up(): void
{
$this->searchAndReplace('TYPO3\SwiftMailer', 'Neos\SwiftMailer');
$this->searchAndReplace('TYPO3.SwiftMailer', 'Neos.SwiftMailer');
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"MIT"
],
"require": {
"neos/flow": "^5.2 || ^6.0 || ^7.0 || ^8.0 ||dev-master",
"swiftmailer/swiftmailer": "^6.0"
"neos/flow": "^8.3 || ^9.0 || dev-main",
"swiftmailer/swiftmailer": "^6.2.5"
},
"autoload": {
"psr-4": {
Expand Down