-
Notifications
You must be signed in to change notification settings - Fork 95
Add FormTypeExtensionInterface stub #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FormTypeExtensionInterface stub #108
Conversation
Thank you for writing phpstan!
I accept the code of conduct in phpstan/phpstan-src
Greetings
Hi, what kind of bug this solves? Thank you.
use \Symfony\Component\Form\FormTypeExtensionInterface; Class MyTypeExtension implements FormTypeExtensionInterface { public function buildForm(FormBuilderInterface $builder, array $options) { } \
phpstan would say:
$options type has no value type specified in iterable type array
its the same case as the FormTypeInterface Stub
How does the $options
array going into these methods usually looks like?
e.g. for a collection type
[ 'entry_type' => EmailType::class, 'entry_options' => [ 'attr' => ['class' => 'email-box'], ], ]);
basically everything mentioned here https://symfony.com/doc/current/reference/forms/types.html#other-fields
listed as options of the form types.
But could be custom options, too, depends on the formType (if it is a custom one, too)
So is it array<string, mixed>
?
yes sir, exactly as stated in the stub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the correct type
Nope, your stub says array<mixed>
.
arg, right 👍
but then its the same case as for
stubs/FormTypeInterface.stub
should I create a PR to fix it there, too?
Push the fix here in this PR, thanks.
48cf529
to
5a1e3f3
Compare
Thank you, tagged as 0.12.10.
Since it implements nearly the same interface, but isn't typehinted either ($options missing iterable type)
How can I test that?