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

[TypeInfo] Handlekey-of andvalue-of types#60655

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

Merged
nicolas-grekas merged 1 commit intosymfony:7.2frommtarld:fix/type-info-value-of
Jun 4, 2025

Conversation

mtarld
Copy link
Contributor

@mtarldmtarld commentedJun 3, 2025
edited
Loading

QA
Branch?7.2
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#60643
LicenseMIT

Add missing support forkey-of andvalue-of type.

@stof
Copy link
Member

stof commentedJun 3, 2025

Be careful, there is 2 differentvalue-of supported cases in phpstan and psalm:

  • value-of<T> withT being a BackedEnum type returns the union of all backing values of that enum (which we can generalize to the backing type as done in this PR)
  • value-of<T> withT being an array type returns the type of values in that array (there is alsokey-of<T> for the equivalent for the key type)

@mtarld
Copy link
ContributorAuthor

Oh, didn't know about that, I'll update the PR accordingly, thanks!

@mtarldmtarldforce-pushed thefix/type-info-value-of branch from54460fa to4c8d14bCompareJune 3, 2025 11:57
@mtarld
Copy link
ContributorAuthor

Done.

@mtarldmtarldforce-pushed thefix/type-info-value-of branch from4c8d14b to4457633CompareJune 3, 2025 12:38
@mtarldmtarld changed the title[TypeInfo] Handlevalue-of type[TypeInfo] Handlekey-of andvalue-of typesJun 3, 2025
@OskarStark
Copy link
Contributor

Looks like a feature to me

@jack-worman
Copy link
Contributor

jack-worman commentedJun 4, 2025
edited
Loading

Looks like a feature to me

I consider this a bug because when I upgraded to Symfony 7.3 the TypeInfo component started throwing an exception. This is because 7.3 introduced handling type aliases, and my code had avalue-of<T> in it.

So, until this is fixed I have to not usevalue-of<T> (and have worse static analysis) or not use TypeInfo (and do something 🤷 )

@nicolas-grekas
Copy link
Member

Thank you@mtarld.

@nicolas-grekasnicolas-grekas merged commit39d4e97 intosymfony:7.2Jun 4, 2025
10 of 11 checks passed
@mtarldmtarld deleted the fix/type-info-value-of branchJune 4, 2025 08:37
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.2
Development

Successfully merging this pull request may close these issues.

6 participants
@mtarld@stof@OskarStark@jack-worman@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp