Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed OptionsResolverInterface usage #1

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions Form/SpecTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\Extension\Core\Type\FormType;

class SpecTypeExtension extends AbstractTypeExtension
Expand All @@ -18,7 +17,7 @@ public function configureOptions(OptionsResolver $resolver)
$this->setDefaultOptions($resolver);
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
public function setDefaultOptions(OptionsResolver $resolver)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

Aren't we also supposed to define the configureOptions method instead of setDefaultOptions? (cf: https://symfony.com/doc/2.8/forms.html#creating-form-classes)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: it's already defined in the file (and it calls setDefaultOptions).

It's probably done this way to ensure BC for Symfony <2.8. I'll make sure that it's really necessary to maintain compatibility for <2.8 and if not, I'll cleanup the code.

{
$resolver->setDefaults([
'spec_transformer' => 'string', // string, array, boolean
Expand Down