diff --git a/src/Stubs/common/Component/Form/FormView.stubphp b/src/Stubs/common/Component/Form/FormView.stubphp index d92f09a9..19c9c2e7 100644 --- a/src/Stubs/common/Component/Form/FormView.stubphp +++ b/src/Stubs/common/Component/Form/FormView.stubphp @@ -3,6 +3,7 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\FormErrorIterator; /** * @template T @@ -13,11 +14,24 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable * @psalm-suppress MixedArrayAssignment * @psalm-suppress InvalidArrayOffset * - * @psalm-var array{value: ?T, attr: array}&array + * @psalm-var array{value: ?T, attr: array, errors: ?FormErrorIterator, valid: bool, data: ?mixed, required: bool, label_attr: array, help: ?string, help_attr: array, help_html: bool, help_translation_parameters: array, compound: bool, method: string, action: string, submitted: bool}&array */ public array $vars = [ 'value' => null, 'attr' => [], + 'errors' => null, + 'valid' => true, + 'data' => null, + 'required' => false, + 'label_attr' => [], + 'help' => null, + 'help_attr' => [], + 'help_html' => false, + 'help_translation_parameters' => [], + 'compound' => false, + 'method' => 'POST', + 'action' => '', + 'submitted' => false, ]; /** diff --git a/tests/acceptance/acceptance/forms/FormView.feature b/tests/acceptance/acceptance/forms/FormView.feature index 68dae868..50e9f5cf 100644 --- a/tests/acceptance/acceptance/forms/FormView.feature +++ b/tests/acceptance/acceptance/forms/FormView.feature @@ -3,6 +3,7 @@ Feature: Form view Background: Given I have Symfony plugin enabled + Scenario: FormView test Given I have the following code """ @@ -28,6 +29,48 @@ Feature: Form view $viewData = $view->vars['value']; /** @psalm-trace $viewData */ + $valid = $view->vars['valid']; + /** @psalm-trace $valid */ + + $errors = $view->vars['errors']; + /** @psalm-trace $errors */ + + $valid = $view->vars['valid']; + /** @psalm-trace $valid */ + + $data = $view->vars['data']; + /** @psalm-trace $data */ + + $required = $view->vars['required']; + /** @psalm-trace $required */ + + $label_attr = $view->vars['label_attr']; + /** @psalm-trace $label_attr */ + + $help = $view->vars['help']; + /** @psalm-trace $help */ + + $help_attr = $view->vars['help_attr']; + /** @psalm-trace $help_attr */ + + $help_html = $view->vars['help_html']; + /** @psalm-trace $help_html */ + + $help_translation_parameters = $view->vars['help_translation_parameters']; + /** @psalm-trace $help_translation_parameters */ + + $compound = $view->vars['compound']; + /** @psalm-trace $compound */ + + $method = $view->vars['method']; + /** @psalm-trace $method */ + + $action = $view->vars['action']; + /** @psalm-trace $action */ + + $submitted = $view->vars['submitted']; + /** @psalm-trace $submitted */ + // assert no errors $view->vars['random'] = new \stdClass(); @@ -44,6 +87,20 @@ Feature: Form view | Trace | $parentView: Symfony\Component\Form\FormView\|null | | Trace | $children: array | | Trace | $viewData: User\|null | + | Trace | $valid: bool | + | Trace | $errors: Symfony\Component\Form\FormErrorIterator\|null | | Trace | $attr: array | + | Trace | $valid: bool | + | Trace | $data: mixed\|null | + | Trace | $required: bool | + | Trace | $label_attr: array | + | Trace | $help: string\|null | + | Trace | $help_attr: array | + | Trace | $help_html: bool | + | Trace | $help_translation_parameters: array | + | Trace | $compound: bool | + | Trace | $method: string | + | Trace | $action: string | + | Trace | $submitted: bool | And I see no other errors