Skip to content

Commit 4e4fe06

Browse files
committed
Fixing phpcs and making the registration controller more explicit
1 parent 2ba2b56 commit 4e4fe06

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Resources/skeleton/form/Type.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2727
->add('<?= $form_field ?>', <?= $typeOptions['type'] ?>::class)
2828
<?php else: ?>
2929
->add('<?= $form_field ?>', <?= $typeOptions['type'] ? ($typeOptions['type'].'::class') : 'null' ?>, [
30-
<?= $typeOptions['options_code'] ?>
30+
<?= $typeOptions['options_code']."\n" ?>
3131
])
3232
<?php endif; ?>
3333
<?php endforeach; ?>

src/Resources/skeleton/registration/RegistrationController.tpl.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ class <?= $class_name; ?> extends <?= $parent_class_name; ?><?= "\n" ?>
2323
*/
2424
public function register(Request $request, UserPasswordEncoderInterface $passwordEncoder<?= $authenticator_full_class_name ? sprintf(', GuardAuthenticatorHandler $guardHandler, %s $authenticator', $authenticator_class_name) : '' ?>): Response
2525
{
26-
$form = $this->createForm(<?= $form_class_name ?>::class);
26+
$user = new <?= $user_class_name ?>();
27+
$form = $this->createForm(<?= $form_class_name ?>::class, $user);
2728
$form->handleRequest($request);
2829

2930
if ($form->isSubmitted() && $form->isValid()) {
30-
/** @var <?= $user_class_name ?> */
31-
$user = $form->getData();
32-
3331
// encode the plain password
3432
$user->set<?= ucfirst($password_field) ?>(
3533
$passwordEncoder->encodePassword(

0 commit comments

Comments
 (0)