Skip to content

Commit 3b455dd

Browse files
authored
FormConfigBuilderInterface stub update #197
1 parent d79efd3 commit 3b455dd

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/Stubs/common/forms/FormConfigBuilderInterface.stubphp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Symfony\Component\Form\Event\PreSetDataEvent;
66
use Symfony\Component\Form\Event\PreSubmitEvent;
77
use Symfony\Component\Form\Event\PostSetDataEvent;
88
use Symfony\Component\Form\Event\SubmitEvent;
9+
use Symfony\Component\Form\Event\PostSubmitEvent;
910

1011
/**
1112
* @template T
@@ -21,7 +22,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface
2122
/**
2223
* @psalm-param FormEvents::* $eventName
2324
*
24-
* @psalm-param callable(PreSetDataEvent<T>)|callable(PostSetDataEvent<T>)|callable(PreSubmitEvent)|callable(SubmitEvent<T>) $listener
25+
* @psalm-param callable(PreSetDataEvent<T>)|callable(PostSetDataEvent<T>)|callable(PreSubmitEvent)|callable(SubmitEvent<T>)|callable(PostSubmitEvent<T>) $listener
2526
*/
2627
public function addEventListener($eventName, $listener, $priority = 0);
2728
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Symfony\Component\Form\Event;
4+
5+
use Symfony\Component\Form\FormEvent;
6+
7+
/**
8+
* @template T
9+
*
10+
* @template-extends FormEvent<T>
11+
*/
12+
class PostSubmitEvent extends FormEvent
13+
{
14+
}
15+

tests/acceptance/acceptance/forms/FormConfigBuilterInterface.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feature: Form config builder
1212
1313
use Symfony\Component\Form\AbstractType;
1414
use Symfony\Component\Form\FormBuilderInterface;
15-
use Symfony\Component\Form\Event\{PreSubmitEvent, PreSetDataEvent, PostSetDataEvent, SubmitEvent};
15+
use Symfony\Component\Form\Event\{PreSubmitEvent, PreSetDataEvent, PostSetDataEvent, SubmitEvent, PostSubmitEvent};
1616
use Symfony\Component\Form\FormEvents;
1717
1818
/** @extends AbstractType<User> */
@@ -40,6 +40,11 @@ Feature: Form config builder
4040
/** @psalm-trace $submitData */
4141
});
4242
43+
$builder->addEventListener(FormEvents::POST_SUBMIT, function(PostSubmitEvent $event) {
44+
$postSubmitData = $event->getData();
45+
/** @psalm-trace $postSubmitData */
46+
});
47+
4348
$config = $builder->getFormConfig();
4449
/** @psalm-trace $config */
4550
}
@@ -53,5 +58,6 @@ Feature: Form config builder
5358
| Trace | $postSetData: User\|null |
5459
| Trace | $preSubmitData: array<string, mixed> |
5560
| Trace | $submitData: User\|null |
61+
| Trace | $postSubmitData: User\|null |
5662
And I see no other errors
5763

0 commit comments

Comments
 (0)