Symfony Upgrade Fixer FTW

symfony-upgrade-fixer fix src/Wallabag/
This commit is contained in:
Jeremy Benoist
2015-12-22 10:16:34 +01:00
parent 516022d60e
commit 619cc45359
41 changed files with 137 additions and 113 deletions

View File

@ -3,6 +3,9 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Validator\Constraints;
@ -12,10 +15,10 @@ class ChangePasswordType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('old_password', 'password', array(
->add('old_password', PasswordType::class, array(
'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
))
->add('new_password', 'repeated', array(
->add('new_password', RepeatedType::class, array(
'type' => 'password',
'invalid_message' => 'The password fields must match.',
'required' => true,
@ -29,11 +32,11 @@ class ChangePasswordType extends AbstractType
new Constraints\NotBlank(),
),
))
->add('save', 'submit')
->add('save', SubmitType::class)
;
}
public function getName()
public function getBlockPrefix()
{
return 'change_passwd';
}

View File

@ -3,6 +3,8 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -28,15 +30,15 @@ class ConfigType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('theme', 'choice', array(
->add('theme', ChoiceType::class, array(
'choices' => array_flip($this->themes),
'choices_as_values' => true,
))
->add('items_per_page')
->add('language', 'choice', array(
->add('language', ChoiceType::class, array(
'choices' => $this->languages,
))
->add('save', 'submit')
->add('save', SubmitType::class)
;
}
@ -47,7 +49,7 @@ class ConfigType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'config';
}

View File

@ -3,6 +3,9 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -11,14 +14,14 @@ class EditEntryType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', 'text', array('required' => true))
->add('is_public', 'checkbox', array('required' => false))
->add('title', TextType::class, array('required' => true))
->add('is_public', CheckboxType::class, array('required' => false))
// @todo: add autocomplete
// ->add('tags', 'entity', array(
// 'class' => 'Wallabag\CoreBundle\Entity\Tag',
// 'choice_translation_domain' => true,
// ))
->add('save', 'submit')
->add('save', SubmitType::class)
;
}
@ -29,7 +32,7 @@ class EditEntryType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'entry';
}

View File

@ -3,6 +3,8 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -11,8 +13,8 @@ class NewEntryType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('url', 'url', array('required' => true))
->add('save', 'submit')
->add('url', UrlType::class, array('required' => true))
->add('save', SubmitType::class)
;
}
@ -23,7 +25,7 @@ class NewEntryType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'entry';
}

View File

@ -3,6 +3,8 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -11,8 +13,8 @@ class NewTagType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label', 'text', array('required' => true))
->add('save', 'submit')
->add('label', TextType::class, array('required' => true))
->add('save', SubmitType::class)
;
}
@ -23,7 +25,7 @@ class NewTagType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'tag';
}

View File

@ -3,6 +3,10 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints;
@ -12,8 +16,8 @@ class NewUserType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('username', 'text', array('required' => true))
->add('plainPassword', 'repeated', array(
->add('username', TextType::class, array('required' => true))
->add('plainPassword', RepeatedType::class, array(
'type' => 'password',
'constraints' => array(
new Constraints\Length(array(
@ -23,8 +27,8 @@ class NewUserType extends AbstractType
new Constraints\NotBlank(),
),
))
->add('email', 'email')
->add('save', 'submit')
->add('email', EmailType::class)
->add('save', SubmitType::class)
;
}
@ -35,7 +39,7 @@ class NewUserType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'new_user';
}

View File

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -12,7 +13,7 @@ class RssType extends AbstractType
{
$builder
->add('rss_limit')
->add('save', 'submit')
->add('save', SubmitType::class)
;
}
@ -23,7 +24,7 @@ class RssType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'rss_config';
}

View File

@ -3,6 +3,8 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Wallabag\CoreBundle\Form\DataTransformer\StringToListTransformer;
@ -12,8 +14,8 @@ class TaggingRuleType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('rule', 'text', array('required' => true))
->add('save', 'submit')
->add('rule', TextType::class, array('required' => true))
->add('save', SubmitType::class)
;
$tagsField = $builder
@ -30,7 +32,7 @@ class TaggingRuleType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'tagging_rule';
}

View File

@ -3,6 +3,10 @@
namespace Wallabag\CoreBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -11,10 +15,10 @@ class UserInformationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text')
->add('email', 'email')
->add('twoFactorAuthentication', 'checkbox', array('required' => false))
->add('save', 'submit')
->add('name', TextType::class)
->add('email', EmailType::class)
->add('twoFactorAuthentication', CheckboxType::class, array('required' => false))
->add('save', SubmitType::class)
->remove('username')
->remove('plainPassword')
;
@ -32,7 +36,7 @@ class UserInformationType extends AbstractType
));
}
public function getName()
public function getBlockPrefix()
{
return 'update_user';
}