Skip to content

Commit

Permalink
BUGFIX: Require Swift_Transport instead of TransportInterface
Browse files Browse the repository at this point in the history
With TransportInterface as return type, original SwiftMailer transports
could not be created
  • Loading branch information
daniellienert committed Dec 31, 2018
1 parent e732f46 commit b1c2356
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Classes/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class TransportFactory
* @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 TransportInterface The created transport instance
* @return \Swift_Transport The created transport instance
* @throws Exception
* @throws \ReflectionException
*/
public function create(string $transportType, array $transportOptions = [], array $transportArguments = null): TransportInterface
public function create(string $transportType, array $transportOptions = [], array $transportArguments = null): \Swift_Transport
{
if (!class_exists($transportType)) {
throw new Exception(sprintf('The specified transport backend "%s" does not exist.', $transportType), 1269351207);
Expand All @@ -44,7 +44,7 @@ public function create(string $transportType, array $transportOptions = [], arra
$transport = new $transportType();
}

if ($transport instanceof TransportInterface) {
if ($transport instanceof \Swift_Transport) {
foreach ($transportOptions as $optionName => $optionValue) {
if (ObjectAccess::isPropertySettable($transport, $optionName)) {
ObjectAccess::setProperty($transport, $optionName, $optionValue);
Expand All @@ -54,6 +54,6 @@ public function create(string $transportType, array $transportOptions = [], arra
return $transport;
}

throw new Exception(sprintf('The specified transport backend "%s" does not implement %s.', $transportType, TransportInterface::class), 1544727431);
throw new Exception(sprintf('The specified transport backend "%s" does not implement %s.', $transportType, \Swift_Transport::class), 1544727431);
}
}

0 comments on commit b1c2356

Please sign in to comment.