Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Jan 8, 2015
1 parent d03a402 commit c3b4137
Show file tree
Hide file tree
Showing 32 changed files with 103 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private function loadFormNode()
'pattern' => true,
'time' => true,
'one_or_other' => true,
'required_group' => true
'required_group' => true,
))
->treatFalseLike(array())
->addDefaultsIfNotSet()
Expand Down
6 changes: 3 additions & 3 deletions src/Form/Extension/FormTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ public function finishView(FormView $view, FormInterface $form, array $options)
// Store child builders to be later compiled
$rootView->vars['rule_builder_children'][] = array(
'view' => $view,
'builder' => $view->vars['rule_builder']
'builder' => $view->vars['rule_builder'],
);
unset($view->vars['rule_builder']);
}

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'jquery_validation' => $this->defaultEnabled
'jquery_validation' => $this->defaultEnabled,
));
$resolver->setAllowedTypes(array(
'jquery_validation' => array('bool', 'null')
'jquery_validation' => array('bool', 'null'),
));
}

Expand Down
1 change: 1 addition & 0 deletions src/Form/Rule/Processor/ViewTransformerProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected function getFormRuleMessage(FormConfigInterface $config)
// Get correct error message if one is set.
if ($config->hasOption('invalid_message')) {
$params = $config->getOption('invalid_message_parameters');

return new RuleMessage(
$config->getOption('invalid_message'),
is_array($params) ? $params : array()
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/form_rule_additional_mappers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ services:
arguments: [ %boekkooi.jquery_validation.additional.accept% ]
public: false
tags:
- { name: form_rule_constraint_mapper }
- { name: form_rule_constraint_mapper }
9 changes: 4 additions & 5 deletions src/Twig/JqueryValidationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getFunctions()
'form_jquery_validation',
array($this, 'renderJavascript'),
array('needs_environment' => true, 'pre_escape' => array('html', 'js'), 'is_safe' => array('html', 'js'))
)
),
);
}

Expand Down Expand Up @@ -69,7 +69,7 @@ public function renderJavascript(\Twig_Environment $twig, FormView $view)

$js = $twig->render($template, $templateVars);

return preg_replace('/\s+/', ' ' , $js);
return preg_replace('/\s+/', ' ', $js);
}

protected function validationGroupsViewData(FormRuleContext $context)
Expand Down Expand Up @@ -98,21 +98,20 @@ protected function buttonsViewData(FormRuleContext $context)
$buttons[] = array(
'name' => $name,
'cancel' => count($groups) === 0,
'validation_groups' => $groups
'validation_groups' => $groups,
);
}

return $buttons;
}


protected function fieldRulesViewData(FormRuleContext $context)
{
$fields = array();
foreach ($context->all() as $name => $rules) {
$fields[] = array(
'name' => $name,
'rules' => $rules
'rules' => $rules,
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/BasicFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BasicFormTest extends FormTestCase
protected static function getSymfonyOptions()
{
return array(
'enable_additionals' => false
'enable_additionals' => false,
);
}

Expand Down
11 changes: 6 additions & 5 deletions tests/Functional/FormTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static function setUpBeforeClass()
parent::setUpBeforeClass();

foreach (static::getSymfonyOptions() as $option => $value) {
$_SERVER['SYMFONY__' . $option] = $value;
$_SERVER['SYMFONY__'.$option] = $value;
}
}

Expand All @@ -30,7 +30,8 @@ public static function tearDownAfterClass()
static::$kernel = null;
}

protected static function getSymfonyOptions() {
protected static function getSymfonyOptions()
{
return array();
}

Expand Down Expand Up @@ -63,7 +64,7 @@ protected function stripWhiteSpace($js)
array(', ', ' { ', ' } ', ' : ', '; ', ' function '),
trim($js)
);
return preg_replace('/(\s+|\n)/', ' ' , trim($js));
}

}
return preg_replace('/(\s+|\n)/', ' ', trim($js));
}
}
4 changes: 2 additions & 2 deletions tests/Functional/TestBundle/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ private function handleForm(Request $request, FormInterface $form)
{
$form->handleRequest($request);
if ($form->isValid()) {
$this->addNotice(date('H:i:s') . ': Valid');
$this->addNotice(date('H:i:s').': Valid');
} elseif ($request->isMethod('POST')) {
$this->addNotice( date('H:i:s') . ': Invalid');
$this->addNotice(date('H:i:s').': Invalid');
}
}

Expand Down
32 changes: 16 additions & 16 deletions tests/Functional/TestBundle/Form/Type/AdditionalRulesFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,43 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('ipv4', null, array(
'constraints' => array(
new Constraints\Ip(array(
'version' => Constraints\Ip::V4
))
)
'version' => Constraints\Ip::V4,
)),
),
))
->add('ipv6', null, array(
'constraints' => array(
new Constraints\Ip(array(
'version' => Constraints\Ip::V6
))
)
'version' => Constraints\Ip::V6,
)),
),
))
->add('ipv4_ipv6', null, array(
'constraints' => array(
new Constraints\Ip(array(
'version' => Constraints\Ip::ALL
))
)
'version' => Constraints\Ip::ALL,
)),
),
))

->add('iban', null, array(
'constraints' => array(
new Constraints\Iban()
)
new Constraints\Iban(),
),
))

->add('luhn', null, array(
'constraints' => array(
new Constraints\Luhn()
)
new Constraints\Luhn(),
),
))

->add('file', 'file', array(
'constraints' => array(
new Constraints\File(array(
'mimeTypes' => array('text/plain', 'application/pdf')
))
)
'mimeTypes' => array('text/plain', 'application/pdf'),
)),
),
))
;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Functional/TestBundle/Form/Type/ButtonsFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Constraints\Length(array(
'min' => 8,
'max' => 200,
'groups' => 'main'
))
)
'groups' => 'main',
)),
),
))
->add('content', 'textarea', array(
'constraints' => array(
new Constraints\NotBlank(),
new Constraints\Length(array(
'min' => 8,
'max' => 200,
'groups' => 'never_used'
))
)
'groups' => 'never_used',
)),
),
))
->add('defaultValidation', 'submit')
->add('mainValidation', 'submit', array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Constraints\Length(array(
'min' => 8,
'max' => 200,
))
)
)),
),
))
->add('tags', 'collection', array(
'type' => new SimpleFormType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => array(
new Constraints\Count(array(
'min' => 1,
'max' => 5
))
'max' => 5,
)),
),

'allow_add' => true,
Expand All @@ -29,9 +29,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'options' => array(
'widget' => 'text',
'constraints' => array(
new Constraints\NotBlank()
)
)
new Constraints\NotBlank(),
),
),
))
->add('defaultValidation', 'submit')
->add('mainValidation', 'submit', array(
Expand Down
14 changes: 7 additions & 7 deletions tests/Functional/TestBundle/Form/Type/CollectionFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Constraints\Length(array(
'min' => 8,
'max' => 200,
))
)
)),
),
))
->add('tags', 'collection', array(
'type' => 'text',
'constraints' => array(
new Constraints\Count(array(
'min' => 1,
'max' => 5
))
'max' => 5,
)),
),

'allow_add' => true,
Expand All @@ -38,9 +38,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'prototype_name' => 'tag__name__',
'options' => array(
'constraints' => array(
new Constraints\NotBlank()
)
)
new Constraints\NotBlank(),
),
),
))
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Constraints\Length(array(
'min' => 8,
'max' => 200,
'groups' => 'main'
))
)
'groups' => 'main',
)),
),
))
->add('tags', 'collection', array(
'type' => 'text',
'constraints' => array(
new Constraints\Count(array(
'min' => 1,
'max' => 5
))
'max' => 5,
)),
),

'allow_add' => true,
Expand All @@ -43,10 +43,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
new Constraints\Length(array(
'min' => 8,
'max' => 200,
'groups' => 'main'
))
)
)
'groups' => 'main',
)),
),
),
))
->add('defaultValidation', 'submit')
->add('mainValidation', 'submit', array(
Expand Down
16 changes: 8 additions & 8 deletions tests/Functional/TestBundle/Form/Type/DateTimeFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'DateTime choice',
'required' => false,
'constraints' => array(
new Constraints\NotBlank()
)
new Constraints\NotBlank(),
),
))

->add('date_choice', 'date', array(
'label' => 'Date choice',
'required' => false,
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))
->add('date_text', 'date', array(
'widget' => 'text',
'label' => 'Date text',
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))
->add('date_single_text', 'date', array(
'widget' => 'single_text',
'label' => 'Date single text',
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))

Expand All @@ -48,21 +48,21 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'Time choice',
'required' => false,
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))
->add('time_text', 'time', array(
'widget' => 'text',
'label' => 'Time text',
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))
->add('time_single_text', 'time', array(
'widget' => 'single_text',
'label' => 'Time single text',
'constraints' => array(
new Constraints\NotBlank()
new Constraints\NotBlank(),
),
))
;
Expand Down
Loading

0 comments on commit c3b4137

Please sign in to comment.