Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

Copy link
Contributor

@pscheit-lillydoo pscheit-lillydoo commented Oct 22, 2020

Since it implements nearly the same interface, but isn't typehinted either ($options missing iterable type)

How can I test that?

Copy link
Contributor Author

Thank you for writing phpstan!

I accept the code of conduct in phpstan/phpstan-src

Greetings

Copy link
Member

Hi, what kind of bug this solves? Thank you.

Copy link
Contributor Author

pscheit-lillydoo commented Oct 22, 2020
edited
Loading

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

Copy link
Member

How does the $options array going into these methods usually looks like?

Copy link
Contributor Author

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)

Copy link
Member

So is it array<string, mixed>?

Copy link
Contributor Author

yes sir, exactly as stated in the stub

interface FormTypeExtensionInterface
{
/**
* @param array<mixed> $options
Copy link
Contributor Author

@pscheit-lillydoo pscheit-lillydoo Oct 22, 2020

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

Copy link
Member

Nope, your stub says array<mixed>.

pscheit-lillydoo reacted with laugh emoji

Copy link
Contributor Author

pscheit-lillydoo commented Oct 22, 2020
edited
Loading

arg, right 👍

but then its the same case as for
stubs/FormTypeInterface.stub

should I create a PR to fix it there, too?

Copy link
Member

Push the fix here in this PR, thanks.

pscheit-lillydoo reacted with rocket emoji

Copy link
Member

Thank you, tagged as 0.12.10.

pscheit-lillydoo reacted with heart emoji

@pscheit-lillydoo pscheit-lillydoo deleted the form-type-extension-stub branch October 22, 2020 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /