mirror of
https://github.com/danog/psalm-plugin-symfony.git
synced 2024-11-30 04:29:10 +01:00
FormConfigBuilderInterface stub update #197
This commit is contained in:
parent
d79efd38b6
commit
3b455dd263
@ -6,6 +6,7 @@ use Symfony\Component\Form\Event\PreSetDataEvent;
|
||||
use Symfony\Component\Form\Event\PreSubmitEvent;
|
||||
use Symfony\Component\Form\Event\PostSetDataEvent;
|
||||
use Symfony\Component\Form\Event\SubmitEvent;
|
||||
use Symfony\Component\Form\Event\PostSubmitEvent;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
@ -21,7 +22,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
||||
/**
|
||||
* @psalm-param FormEvents::* $eventName
|
||||
*
|
||||
* @psalm-param callable(PreSetDataEvent<T>)|callable(PostSetDataEvent<T>)|callable(PreSubmitEvent)|callable(SubmitEvent<T>) $listener
|
||||
* @psalm-param callable(PreSetDataEvent<T>)|callable(PostSetDataEvent<T>)|callable(PreSubmitEvent)|callable(SubmitEvent<T>)|callable(PostSubmitEvent<T>) $listener
|
||||
*/
|
||||
public function addEventListener($eventName, $listener, $priority = 0);
|
||||
}
|
||||
|
15
src/Stubs/common/forms/PostSubmitEvent.stubphp
Normal file
15
src/Stubs/common/forms/PostSubmitEvent.stubphp
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Form\Event;
|
||||
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
*
|
||||
* @template-extends FormEvent<T>
|
||||
*/
|
||||
class PostSubmitEvent extends FormEvent
|
||||
{
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ Feature: Form config builder
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Event\{PreSubmitEvent, PreSetDataEvent, PostSetDataEvent, SubmitEvent};
|
||||
use Symfony\Component\Form\Event\{PreSubmitEvent, PreSetDataEvent, PostSetDataEvent, SubmitEvent, PostSubmitEvent};
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
|
||||
/** @extends AbstractType<User> */
|
||||
@ -40,6 +40,11 @@ Feature: Form config builder
|
||||
/** @psalm-trace $submitData */
|
||||
});
|
||||
|
||||
$builder->addEventListener(FormEvents::POST_SUBMIT, function(PostSubmitEvent $event) {
|
||||
$postSubmitData = $event->getData();
|
||||
/** @psalm-trace $postSubmitData */
|
||||
});
|
||||
|
||||
$config = $builder->getFormConfig();
|
||||
/** @psalm-trace $config */
|
||||
}
|
||||
@ -53,5 +58,6 @@ Feature: Form config builder
|
||||
| Trace | $postSetData: User\|null |
|
||||
| Trace | $preSubmitData: array<string, mixed> |
|
||||
| Trace | $submitData: User\|null |
|
||||
| Trace | $postSubmitData: User\|null |
|
||||
And I see no other errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user