<?php

namespace MailMotor\Bundle\MailMotorBundle\Factory;

use MailMotor\Bundle\MailMotorBundle\Gateway\SubscriberGateway;
use Symfony\Component\DependencyInjection\ContainerInterface as Container;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * @author Jeroen Desloovere <info@jeroendesloovere.be>
 */
class MailMotorFactory
{
    /** @var Container */
    protected $container;

    /** @var string|null */
    protected $mailEngine;

    public function __construct(
        Container $container,
        ?string $mailEngine
    ) {
        $this->container = $container;
        $this->setMailEngine($mailEngine);
    }

    public function getSubscriberGateway(): SubscriberGateway
    {
        return $this->container->get('mailmotor.' . $this->mailEngine . '.subscriber.gateway');
    }

    protected function setMailEngine(?string $mailEngine): void
    {
        if ($mailEngine == null) {
            $mailEngine = 'not_implemented';
        }

        $this->mailEngine = strtolower($mailEngine);
    }
}

<?php

namespace MailMotor\Bundle\MailMotorBundle\Factory;

use MailMotor\Bundle\MailMotorBundle\Gateway\SubscriberGateway;
use Symfony\Component\DependencyInjection\ContainerInterface as Container;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * @author Jeroen Desloovere <info@jeroendesloovere.be>
 */
class MailMotorFactory
{
    /** @var Container */
    protected $container;

    /** @var string */
    protected $mailEngine;

    public function __construct(
        Container $container,
        string $mailEngine
    ) {
        $this->container = $container;
        $this->setMailEngine($mailEngine);
    }

    public function getSubscriberGateway(): SubscriberGateway
    {
        return $this->container->get('mailmotor.' . $this->mailEngine . '.subscriber.gateway');
    }

    protected function setMailEngine(string $mailEngine): void
    {
        if ($mailEngine == null) {
            $mailEngine = 'not_implemented';
        }

        $this->mailEngine = strtolower($mailEngine);
    }
}

--- 
+++ 
@@ -15,12 +15,12 @@
     /** @var Container */
     protected $container;
 
-    /** @var string */
+    /** @var string|null */
     protected $mailEngine;
 
     public function __construct(
         Container $container,
-        string $mailEngine
+        ?string $mailEngine
     ) {
         $this->container = $container;
         $this->setMailEngine($mailEngine);
@@ -31,7 +31,7 @@
         return $this->container->get('mailmotor.' . $this->mailEngine . '.subscriber.gateway');
     }
 
-    protected function setMailEngine(string $mailEngine): void
+    protected function setMailEngine(?string $mailEngine): void
     {
         if ($mailEngine == null) {
             $mailEngine = 'not_implemented';
Fix error when the mail engine is not set
