Skip to content

Commit c86da84

Browse files
committed
feature #1714 [make:form] suffix with "Type" instead of "Form" (revert) (kbond)
This PR was merged into the 1.x branch. Discussion ---------- [make:form] suffix with "Type" instead of "Form" (revert) This reverts commit 6456718. Fixes: #1711 Fixes: #1698 Fixes: #1697 #1711 makes a good argument for reverting this change. Commits ------- 33591e6 Revert "[make:form] suffix with "Form" instead of "Type""
2 parents 2521656 + 33591e6 commit c86da84

28 files changed

+68
-68
lines changed

config/help/MakeForm.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
The <info>%command.name%</info> command generates a new form class.
22

3-
<info>php %command.full_name% UserForm</info>
3+
<info>php %command.full_name% UserType</info>
44

55
If the argument is missing, the command will ask for the form class interactively.
66

77
You can optionally specify the bound class in a second argument.
88
This can be the name of an entity like <info>User</info>
99

10-
<info>php %command.full_name% UserForm User</info>
10+
<info>php %command.full_name% UserType User</info>
1111

1212
You can also specify a fully qualified name to another class like <info>\App\Dto\UserData</info>.
1313
Slashes must be escaped in the argument.
1414

15-
<info>php %command.full_name% UserForm \\App\\Dto\\UserData</info>
15+
<info>php %command.full_name% UserType \\App\\Dto\\UserData</info>
1616

src/Maker/MakeCrud.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
140140
$iter = 0;
141141
do {
142142
$formClassDetails = $generator->createClassNameDetails(
143-
$entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: ''),
143+
$entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: '').'Type',
144144
'Form\\',
145-
'Form'
145+
'Type'
146146
);
147147
++$iter;
148148
} while (class_exists($formClassDetails->getFullName()));

src/Maker/MakeForm.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function getCommandDescription(): string
5151
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
5252
{
5353
$command
54-
->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. <fg=yellow>%Form</>)', Str::asClassName(Str::getRandomTerm())))
54+
->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. <fg=yellow>%sType</>)', Str::asClassName(Str::getRandomTerm())))
5555
->addArgument('bound-class', InputArgument::OPTIONAL, 'The name of Entity or fully qualified model class name that the new form will be bound to (empty for none)')
5656
->setHelp($this->getHelpFileContents('MakeForm.txt'))
5757
;
@@ -80,7 +80,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
8080
$formClassNameDetails = $generator->createClassNameDetails(
8181
$input->getArgument('name'),
8282
'Form\\',
83-
'Form'
83+
'Type'
8484
);
8585

8686
$formFields = ['field_name' => null];

src/Maker/MakeRegistrationForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public function configureDependencies(DependencyBuilder $dependencies): void
548548
private function generateFormClass(ClassNameDetails $userClassDetails, Generator $generator, string $usernameField): ClassNameDetails
549549
{
550550
$formClassDetails = $generator->createClassNameDetails(
551-
'RegistrationForm',
551+
'RegistrationFormType',
552552
'Form\\'
553553
);
554554

src/Maker/MakeResetPassword.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
227227
);
228228

229229
$requestFormTypeClassNameDetails = $generator->createClassNameDetails(
230-
'ResetPasswordRequestForm',
230+
'ResetPasswordRequestFormType',
231231
'Form\\'
232232
);
233233

234234
$changePasswordFormTypeClassNameDetails = $generator->createClassNameDetails(
235-
'ChangePasswordForm',
235+
'ChangePasswordFormType',
236236
'Form\\'
237237
);
238238

@@ -301,7 +301,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
301301

302302
$generator->generateClass(
303303
$requestFormTypeClassNameDetails->getFullName(),
304-
'resetPassword/ResetPasswordRequestForm.tpl.php',
304+
'resetPassword/ResetPasswordRequestFormType.tpl.php',
305305
[
306306
'use_statements' => $useStatements,
307307
'email_field' => $this->emailPropertyName,
@@ -322,7 +322,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
322322

323323
$generator->generateClass(
324324
$changePasswordFormTypeClassNameDetails->getFullName(),
325-
'resetPassword/ChangePasswordForm.tpl.php',
325+
'resetPassword/ChangePasswordFormType.tpl.php',
326326
['use_statements' => $useStatements]
327327
);
328328

src/Renderer/FormTypeRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function render(ClassNameDetails $formClassDetails, array $formFields, ?C
7070

7171
$this->generator->generateClass(
7272
$formClassDetails->getFullName(),
73-
'form/Form.tpl.php',
73+
'form/Type.tpl.php',
7474
[
7575
'use_statements' => $useStatements,
7676
'bounded_class_name' => $boundClassDetails ? $boundClassDetails->getShortName() : null,
File renamed without changes.

tests/Maker/MakeCrudTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getTestDetails(): \Generator
3939
]);
4040

4141
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
42-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
42+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
4343

4444
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
4545
}),
@@ -59,7 +59,7 @@ public function getTestDetails(): \Generator
5959
]);
6060

6161
$this->assertStringContainsString('src/Controller/SweetFoodAdminController.php', $output);
62-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
62+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
6363

6464
$this->runCrudTest($runner, 'it_generates_crud_with_custom_controller.php');
6565
}),
@@ -80,7 +80,7 @@ public function getTestDetails(): \Generator
8080
]);
8181

8282
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
83-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
83+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
8484
$this->assertStringContainsString('tests/Controller/SweetFoodControllerTest.php', $output);
8585

8686
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
@@ -107,7 +107,7 @@ public function getTestDetails(): \Generator
107107
]);
108108

109109
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
110-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
110+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
111111
$this->assertStringContainsString('tests/Controller/SweetFoodControllerTest.php', $output);
112112

113113
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
@@ -145,7 +145,7 @@ public function getTestDetails(): \Generator
145145
]);
146146

147147
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
148-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
148+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
149149

150150
$this->runCrudTest($runner, 'it_generates_crud_with_custom_root_namespace.php');
151151
}),
@@ -169,7 +169,7 @@ public function getTestDetails(): \Generator
169169
]);
170170

171171
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
172-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
172+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
173173

174174
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
175175
self::assertFileEquals(
@@ -195,7 +195,7 @@ public function getTestDetails(): \Generator
195195
]);
196196

197197
$this->assertStringContainsString('src/Controller/SweetFoodController.php', $output);
198-
$this->assertStringContainsString('src/Form/SweetFoodForm.php', $output);
198+
$this->assertStringContainsString('src/Form/SweetFoodType.php', $output);
199199

200200
$this->runCrudTest($runner, 'it_generates_basic_crud.php');
201201
}),

0 commit comments

Comments
 (0)