Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TypeInfo] Fix type resolution when called class is in other namespace#62997

Merged
nicolas-grekas merged 1 commit into
symfony:7.3from
mtarld:fix/type-info-static
Jan 9, 2026
Merged

[TypeInfo] Fix type resolution when called class is in other namespace#62997
nicolas-grekas merged 1 commit into
symfony:7.3from
mtarld:fix/type-info-static

Conversation

@mtarld
Copy link
Copy Markdown
Contributor

@mtarld mtarld commented Jan 8, 2026

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62922
License MIT

When resolving static return type for a child class in a different namespace than the parent class where the method is declared, the wrong namespace was used.

The fix adds the called class to the uses array when its namespace differs from the declaring class, allowing normalize() to resolve it correctly.

@mtarld mtarld requested a review from dunglas as a code owner January 8, 2026 09:34
@carsonbot carsonbot added this to the 7.3 milestone Jan 8, 2026
@mtarld mtarld changed the title [TypeInfo] Fix static type resolution when called class is in differe… [TypeInfo] Fix static type resolution when called class is in different namespace Jan 8, 2026
@mtarld mtarld changed the title [TypeInfo] Fix static type resolution when called class is in different namespace [TypeInfo] Fix type resolution when called class is in other namespace Jan 8, 2026
@mtarld mtarld force-pushed the fix/type-info-static branch from 24f895a to 84f109a Compare January 8, 2026 09:43
Comment thread src/Symfony/Component/TypeInfo/TypeContext/TypeContextFactory.php Outdated
@mtarld mtarld force-pushed the fix/type-info-static branch from 84f109a to 65bf8ed Compare January 8, 2026 15:19
@mtarld mtarld requested a review from stof January 8, 2026 15:27
@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @mtarld.

@nicolas-grekas nicolas-grekas merged commit d809048 into symfony:7.3 Jan 9, 2026
11 of 12 checks passed
This was referenced Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants