Skip to content

Fix method call on unioned class type analysis is broken#5225

Merged
VincentLanglet merged 5 commits intophpstan:2.1.xfrom
VincentLanglet:create-pull-request/patch-8y7mxaj
Mar 25, 2026
Merged

Fix method call on unioned class type analysis is broken#5225
VincentLanglet merged 5 commits intophpstan:2.1.xfrom
VincentLanglet:create-pull-request/patch-8y7mxaj

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Mar 15, 2026

phpstan-bot and others added 4 commits March 25, 2026 14:37
- In UnionType::getUnresolvedMethodPrototype(), stopped overriding each
  member's calledOnType with the full union for non-template unions
- Template union types (TemplateUnionType, TemplateBenevolentUnionType)
  still propagate the union as calledOnType to preserve template identity
- Updated existing test assertion in static-late-binding.php
- Added regression test tests/PHPStan/Analyser/nsrt/bug-11687.php

Closes phpstan/phpstan#11687
Closes phpstan/phpstan#12562

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Automated fix attempt 1 for CI failures.
Automated fix attempt 2 for CI failures.
@VincentLanglet
Copy link
Contributor Author

I think this test is better than #5299

@VincentLanglet VincentLanglet requested a review from staabm March 25, 2026 13:48
*/
class Collection
{
/**
Copy link
Contributor

@staabm staabm Mar 25, 2026

Choose a reason for hiding this comment

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

this file mixes tabs and spaces for indent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants