Skip to content

Commit

Permalink
Make symfony translator optional (#15)
Browse files Browse the repository at this point in the history
TomaszGasior authored and isometriks committed Apr 12, 2019
1 parent ee17761 commit c0fae40
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ class HoneypotValidationListener implements EventSubscriberInterface
private $fieldName;
private $errorMessage;

public function __construct(TranslatorInterface $translator,
public function __construct(TranslatorInterface $translator = null,
$translationDomain,
$fieldName,
$errorMessage)
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ class TimedSpamValidationListener implements EventSubscriberInterface
private $options;

public function __construct(TimedSpamProviderInterface $timeProvider,
TranslatorInterface $translator,
TranslatorInterface $translator = null,
$translationDomain,
$errorMessage,
$options)
2 changes: 1 addition & 1 deletion Form/Extension/Spam/Type/FormTypeHoneypotExtension.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ class FormTypeHoneypotExtension extends AbstractTypeExtension
private $translationDomain;
private $defaults;

public function __construct(TranslatorInterface $translator,
public function __construct(TranslatorInterface $translator = null,
$translationDomain,
array $defaults)
{
2 changes: 1 addition & 1 deletion Form/Extension/Spam/Type/FormTypeTimedSpamExtension.php
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ class FormTypeTimedSpamExtension extends AbstractTypeExtension
private $defaults;

public function __construct(TimedSpamProviderInterface $timeProvider,
TranslatorInterface $translator,
TranslatorInterface $translator = null,
$translationDomain,
array $defaults)
{
2 changes: 1 addition & 1 deletion Resources/config/honeypot.xml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<services>
<service id="isometriks_spam.form.extension.type.honeypot" class="Isometriks\Bundle\SpamBundle\Form\Extension\Spam\Type\FormTypeHoneypotExtension">
<tag name="form.type_extension" extended-type="Symfony\Component\Form\Extension\Core\Type\FormType" />
<argument type="service" id="translator" />
<argument type="service" id="translator" on-invalid="ignore" />
<argument>%validator.translation_domain%</argument>
</service>
</services>
2 changes: 1 addition & 1 deletion Resources/config/timed.xml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
<service id="isometriks_spam.form.extension.type.timed_spam" class="Isometriks\Bundle\SpamBundle\Form\Extension\Spam\Type\FormTypeTimedSpamExtension">
<tag name="form.type_extension" extended-type="Symfony\Component\Form\Extension\Core\Type\FormType" />
<argument type="service" id="isometriks_spam.form.extension.provider.timed_spam" />
<argument type="service" id="translator" />
<argument type="service" id="translator" on-invalid="ignore" />
<argument>%validator.translation_domain%</argument>
</service>
</services>

0 comments on commit c0fae40

Please sign in to comment.