Skip to content

Commit 4c4ac29

Browse files
ThomasLandauernicolas-grekas
authored andcommitted
[Form] Adding more @var PHPDoc's to silence psalm
1 parent 10b35aa commit 4c4ac29

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Extension/Core/Type/FileType.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\AbstractType;
15+
use Symfony\Component\Form\Event\PreSubmitEvent;
1516
use Symfony\Component\Form\FileUploadError;
1617
use Symfony\Component\Form\FormBuilderInterface;
1718
use Symfony\Component\Form\FormEvent;
@@ -48,6 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4849
{
4950
// Ensure that submitted data is always an uploaded file or an array of some
5051
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options) {
52+
/** @var PreSubmitEvent $event */
5153
$form = $event->getForm();
5254
$requestHandler = $form->getConfig()->getRequestHandler();
5355

Extension/Core/Type/TimeType.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
1919
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
2020
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
21+
use Symfony\Component\Form\Event\PreSubmitEvent;
2122
use Symfony\Component\Form\FormBuilderInterface;
2223
use Symfony\Component\Form\FormEvent;
2324
use Symfony\Component\Form\FormEvents;
@@ -62,6 +63,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6263

6364
if ('single_text' === $options['widget']) {
6465
$builder->addEventListener(FormEvents::PRE_SUBMIT, static function (FormEvent $e) use ($options) {
66+
/** @var PreSubmitEvent $event */
6567
$data = $e->getData();
6668
if ($data && preg_match('/^(?P<hours>\d{2}):(?P<minutes>\d{2})(?::(?P<seconds>\d{2})(?:\.\d+)?)?$/', $data, $matches)) {
6769
if ($options['with_seconds']) {

0 commit comments

Comments
 (0)