diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index d31f6ef6..93960282 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -11,6 +11,14 @@ The `@NucleosProfileBundle/Resources/config/routing/all.xml` routing configurati All listeneres are now registered by default. The `use_authentication_listener`, `use_listener` and `use_flash_notifications` configuration keys were removed. +## Removed `Interface` suffix + +The `Interface` suffix was removed from all interfaces. All default implementation use specific class prefix. + +- `Nucleos\ProfileBundle\Mailer\MailerInterface` => `Nucleos\ProfileBundle\Mailer\RegistrationMailer` +- `Nucleos\ProfileBundle\Mailer\NoopMailer` => `Nucleos\ProfileBundle\Mailer\NoopRegistrationMailer` +- `Nucleos\ProfileBundle\Mailer\Mailer` => `Nucleos\ProfileBundle\Mailer\SimpleRegistrationMailer` +- ## Deprecations All the deprecated code introduced on 1.8.x is removed on 2.0. diff --git a/docs/configuration.rst b/docs/configuration.rst index f51592fe..49ce929c 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -11,4 +11,4 @@ All available configuration options are listed below with their default values. from_email: ~ # Required enabled: false # change to true for required email confirmation service: - mailer: nucleos_profile.mailer.default + mailer: nucleos_profile.mailer.simple diff --git a/docs/mailing.rst b/docs/mailing.rst index 05c938e1..eda1724f 100644 --- a/docs/mailing.rst +++ b/docs/mailing.rst @@ -29,7 +29,7 @@ Default Mailer Implementations The bundle comes with three mailer implementations. They are listed below by service id: -- ``nucleos_profile.mailer.default`` is the default implementation, and uses symfony mailer to send emails. +- ``nucleos_profile.mailer.simple`` is the default implementation, and uses symfony mailer to send emails. - ``nucleos_profile.mailer.noop`` is a mailer implementation which performs no operation, so no emails are sent. Configuring the Sender Email Address diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 2b8a06cf..3163ec49 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -63,7 +63,7 @@ private function addServiceSection(ArrayNodeDefinition $node): void ->arrayNode('service') ->addDefaultsIfNotSet() ->children() - ->scalarNode('mailer')->defaultValue('nucleos_profile.mailer.default')->end() + ->scalarNode('mailer')->defaultValue('nucleos_profile.mailer.simple')->end() ->end() ->end() ->end() diff --git a/src/EventListener/EmailConfirmationListener.php b/src/EventListener/EmailConfirmationListener.php index e6ca8cc6..bbb9126e 100644 --- a/src/EventListener/EmailConfirmationListener.php +++ b/src/EventListener/EmailConfirmationListener.php @@ -12,7 +12,7 @@ namespace Nucleos\ProfileBundle\EventListener; use Nucleos\ProfileBundle\Event\UserFormEvent; -use Nucleos\ProfileBundle\Mailer\MailerInterface; +use Nucleos\ProfileBundle\Mailer\RegistrationMailer; use Nucleos\ProfileBundle\NucleosProfileEvents; use Nucleos\UserBundle\Util\TokenGenerator; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -22,7 +22,7 @@ final class EmailConfirmationListener implements EventSubscriberInterface { - private MailerInterface $mailer; + private RegistrationMailer $mailer; private TokenGenerator $tokenGenerator; @@ -31,7 +31,7 @@ final class EmailConfirmationListener implements EventSubscriberInterface private SessionInterface $session; public function __construct( - MailerInterface $mailer, + RegistrationMailer $mailer, TokenGenerator $tokenGenerator, UrlGeneratorInterface $router, SessionInterface $session diff --git a/src/Mailer/NoopMailer.php b/src/Mailer/NoopRegistrationMailer.php similarity index 89% rename from src/Mailer/NoopMailer.php rename to src/Mailer/NoopRegistrationMailer.php index 5df9a50d..9664761e 100644 --- a/src/Mailer/NoopMailer.php +++ b/src/Mailer/NoopRegistrationMailer.php @@ -18,7 +18,7 @@ * It is used when the 'email' configuration is not set, * and allows to use this bundle without swiftmailer. */ -final class NoopMailer implements MailerInterface +final class NoopRegistrationMailer implements RegistrationMailer { public function sendConfirmationEmailMessage(UserInterface $user): void { diff --git a/src/Mailer/MailerInterface.php b/src/Mailer/RegistrationMailer.php similarity index 94% rename from src/Mailer/MailerInterface.php rename to src/Mailer/RegistrationMailer.php index abc91fd4..6032ac2e 100644 --- a/src/Mailer/MailerInterface.php +++ b/src/Mailer/RegistrationMailer.php @@ -13,7 +13,7 @@ use Nucleos\UserBundle\Model\UserInterface; -interface MailerInterface +interface RegistrationMailer { /** * Send an email to a user to confirm the account creation. diff --git a/src/Mailer/Mailer.php b/src/Mailer/SimpleRegistrationMailer.php similarity index 96% rename from src/Mailer/Mailer.php rename to src/Mailer/SimpleRegistrationMailer.php index ef2100c7..d83905ab 100644 --- a/src/Mailer/Mailer.php +++ b/src/Mailer/SimpleRegistrationMailer.php @@ -19,7 +19,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; -final class Mailer implements MailerInterface +final class SimpleRegistrationMailer implements RegistrationMailer { private SymfonyMailer $mailer; diff --git a/src/Resources/config/mailer.php b/src/Resources/config/mailer.php index 648932f2..f378f8f4 100644 --- a/src/Resources/config/mailer.php +++ b/src/Resources/config/mailer.php @@ -11,15 +11,15 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; -use Nucleos\ProfileBundle\Mailer\Mailer; -use Nucleos\ProfileBundle\Mailer\NoopMailer; +use Nucleos\ProfileBundle\Mailer\NoopRegistrationMailer; +use Nucleos\ProfileBundle\Mailer\SimpleRegistrationMailer; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; return static function (ContainerConfigurator $container): void { $container->services() - ->set('nucleos_profile.mailer.default', Mailer::class) + ->set('nucleos_profile.mailer.simple', SimpleRegistrationMailer::class) ->args([ new Reference('mailer.mailer'), new Reference('translator'), @@ -27,7 +27,7 @@ new Parameter('nucleos_profile.registration.confirmation.from_email'), ]) - ->set('nucleos_profile.mailer.noop', NoopMailer::class) + ->set('nucleos_profile.mailer.noop', NoopRegistrationMailer::class) ; }; diff --git a/tests/DependencyInjection/NucleosProfileExtensionTest.php b/tests/DependencyInjection/NucleosProfileExtensionTest.php index 6487337a..a897184d 100644 --- a/tests/DependencyInjection/NucleosProfileExtensionTest.php +++ b/tests/DependencyInjection/NucleosProfileExtensionTest.php @@ -25,7 +25,7 @@ public function testUserLoadUtilServiceWithDefaults(): void { $this->createEmptyConfiguration(); - $this->assertAlias('nucleos_profile.mailer.default', 'nucleos_profile.mailer'); + $this->assertAlias('nucleos_profile.mailer.simple', 'nucleos_profile.mailer'); } public function testUserLoadUtilService(): void