Skip to content

POC: Use SimultaneousTypeTraverser in RuleLevelHelper::transformAcceptedType #4210

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Aug 6, 2025

Static analysis is failing because TypeTraverserInstanceofVisitor doesn't support SimultaneousTypeTraverser (not sure it should).

The only current test failing is

16: Function ReturnListNullables\doFoo() should return array<string>|null but returns list<string|null>.

but I feel like we could reproduce more errors because...

UnionType/Intersection types doesn't work well with the SimultaneousTypeTraverser because

  • when it's called with A&B&C and A we're not traversing because second type is not an Intersection
  • when it's called with A&B&C and A&C we're not traversing because types count are different

The main issue would be, when traversing A&B&C and A&C, to match types in order to

  • traverse (A, A)
  • traverse (B, Never)
  • traverse (C, C)

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.

1 participant