Skip to content

Commit

Permalink
Fix compatibility with Symfony 5
Browse files Browse the repository at this point in the history
  • Loading branch information
isometriks committed Aug 11, 2020
1 parent c988bac commit 8266e5a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class HoneypotValidationListener implements EventSubscriberInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class TimedSpamValidationListener implements EventSubscriberInterface
{
Expand Down
20 changes: 2 additions & 18 deletions Form/Extension/Spam/Type/FormTypeHoneypotExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class FormTypeHoneypotExtension extends AbstractTypeExtension
{
Expand Down Expand Up @@ -74,11 +73,6 @@ public function finishView(FormView $view, FormInterface $form, array $options)
}
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
Expand All @@ -95,16 +89,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public static function getExtendedTypes(): iterable
{
return [
FormType::class,
];
}

public function getExtendedType()
{
return method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')
? FormType::class
: 'form' // SF <2.8 BC
;
return [FormType::class];
}
}
20 changes: 2 additions & 18 deletions Form/Extension/Spam/Type/FormTypeTimedSpamExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class FormTypeTimedSpamExtension extends AbstractTypeExtension
{
Expand Down Expand Up @@ -59,11 +58,6 @@ public function finishView(FormView $view, FormInterface $form, array $options)
}
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$this->configureOptions($resolver);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
Expand All @@ -79,16 +73,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public static function getExtendedTypes(): iterable
{
return [
FormType::class,
];
}

public function getExtendedType()
{
return method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')
? FormType::class
: 'form' // SF <2.8 BC
;
return [FormType::class];
}
}

0 comments on commit 8266e5a

Please sign in to comment.