-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Current definition is the following:
psalm-plugin-symfony/src/Stubs/5/Bundle/FrameworkBundle/Controller/AbstractController.stubphp
Lines 18 to 26 in fb801a9
| /** | |
| * @template TData | |
| * @template TFormType of FormTypeInterface<TData> | |
| * | |
| * @psalm-param class-string<TFormType> $type | |
| * | |
| * @psalm-return FormInterface<TData> | |
| */ | |
| protected function createForm(string $type, $data = null, array $options = []): FormInterface {} |
I suggest to change it to:
/**
* @template TData
* @template TFormType of FormTypeInterface<TData>
*
* @psalm-param class-string<TFormType> $type
* @psalm-param TData $data
*
* @psalm-return FormInterface<null|TData>
*/
protected function createForm(string $type, $data = null, array $options = []): FormInterface {}What has changed:
TData $dataparameter addednull|TDatageneric parameter changed for the return type
Why: this would allow check the $this->createForm(FormType::class, ['rubbish']) compatibility: if the FormType does not extend AbstractType<array{0: 'rubbish'}> then it will be marked as incompatible.
Thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels