Movatterモバイル変換


[0]ホーム

URL:


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

Fix generic type for FormErrorIterator#45322

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@akalineskou
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

After upgrading symfony/form (v5.4.2 => v5.4.3) I was getting weird phpstan errors

Instanceof between Symfony\Component\Form\FormError and Symfony\Component\Form\FormErrorIterator will always evaluate to false.

I passFormErrorIterator $formErrors and iterate over it, and do different things if it's an instance ofFormErrorIterator orFormError
This change fixes it

It was introduced here
https://github.com/symfony/symfony/pull/42471/files#diff-48af5e26fa9979e5508cc18c8921ed13fd1a870706108285bada83f18278ff8eR32

@carsonbotcarsonbot added this to the5.4 milestoneFeb 4, 2022
@akalineskouakalineskou changed the titleFix generic type for FormErrorIterator[Form] Fix generic type for FormErrorIteratorFeb 4, 2022
@carsonbotcarsonbot changed the title[Form] Fix generic type for FormErrorIteratorFix generic type for FormErrorIteratorFeb 5, 2022
@fabpot
Copy link
Member

Thank you@akalineskou.

akalineskou reacted with rocket emoji

@fabpotfabpot merged commit2e32f2f intosymfony:5.4Feb 5, 2022
@akalineskouakalineskou deleted the form-fix-generic-type-for-form-error-iterator branchFebruary 5, 2022 12:44
This was referencedFeb 28, 2022
fabpot added a commit that referenced this pull requestMar 12, 2022
This PR was squashed before being merged into the 5.4 branch.Discussion----------Make FormErrorIterator generic| Q             | A| ------------- | ---| Branch?       | 5.4| Bug fix?      | yes/no| New feature?  | yes/no| Deprecations? | no| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->I target 5.4, since it's a follow up of#45322 which introduced some errors in my code.It allows to typehint the `Form::getErrors` method to return `FormErrorIterator<FormError>` most of the time (which is possible by psalm/phpstan plugins with ReturnTypeProviders).Commits-------08ddac5 Make FormErrorIterator generic
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@derrabusderrabusderrabus approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

4 participants

@akalineskou@fabpot@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp