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] Add result cache toTypeContextFactory#61765

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

Conversation

@landure
Copy link
Contributor

@landurelandure commentedSep 16, 2025
edited
Loading

QA
Branch?7.4
Bug fix?no
New feature?no
Deprecations?no
IssuesFix#61725
LicenseMIT

Add caches toTypeContextFactory method to prevent multiple parsing of the same classes by PHPStan property extractor.

  1. Add cache to intermediateTypeContext creation fromcreateFromClassName() andcreateFromReflection() by adding:

    • intermediateTypeContextCache proprety.
    • createIntermediateTypeContext() create the intermediateTypeContext if not found in cache.
  2. Add cache tocreateFromClassName() by:

    • typeContextCache proprety.
    • extractingTypeContext creation to privatecreateNewInstanceFromClassName() method.
    • refactoringcreateFromClassName() to get theTypeContext from$this->typeContextCache, or creating it by callingcreateNewInstanceFromClassName() method.
  3. Add a test to check that the results are cached.

This optimize deserialization and form validation.

@OskarStarkOskarStark changed the title[TypeInfo] Add result cache to TypeContextFactory[TypeInfo] Add result cache toTypeContextFactorySep 16, 2025
@landurelandureforce-pushed the61725-type-context-factory-caching branch 2 times, most recently from8a9f8b5 toa29f10bCompareSeptember 16, 2025 08:27
@nicolas-grekasnicolas-grekas modified the milestones:7.3,7.4Sep 16, 2025
@landurelandureforce-pushed the61725-type-context-factory-caching branch 2 times, most recently fromdefb034 tocb47384CompareSeptember 16, 2025 08:37
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For 7.4 as this is a performance improvement.

Add a cache to  method with the aims to optimizedeserialization and form validation.Closessymfony#61725
@fabpotfabpot changed the base branch from7.3 to7.4September 17, 2025 05:44
@fabpotfabpotforce-pushed the61725-type-context-factory-caching branch fromcb47384 toe39963fCompareSeptember 17, 2025 05:44
@fabpot
Copy link
Member

Thank you@landure.

@fabpotfabpot merged commitcc7090f intosymfony:7.4Sep 17, 2025
11 of 12 checks passed
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

[TypeInfo] TypeContextFactory::createFromClassName() needs a result cache

5 participants

@landure@fabpot@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp