Skip to content

Ignore ApiInstanceofTypeRule in SimultaneousTypeTraverser#4452

Open
VincentLanglet wants to merge 1 commit intophpstan:2.1.xfrom
VincentLanglet:traverser
Open

Ignore ApiInstanceofTypeRule in SimultaneousTypeTraverser#4452
VincentLanglet wants to merge 1 commit intophpstan:2.1.xfrom
VincentLanglet:traverser

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Oct 18, 2025

Needed for #4210

@ondrejmirtes
Copy link
Member

I'm not sure about this one yet. It remains to be seen what's the right implementation for a callback in SimultaneousTypeTraverser. Because the implementation of traverseSimultaneously in IntersectionType is not obvious, it might mean that doing instanceof *Type in SimultaneousTypeTraverser callback is really not correct.

I'll keep this open, we'll see.

@VincentLanglet
Copy link
Contributor Author

I'm not sure about this one yet. It remains to be seen what's the right implementation for a callback in SimultaneousTypeTraverser. Because the implementation of traverseSimultaneously in IntersectionType is not obvious, it might mean that doing instanceof *Type in SimultaneousTypeTraverser callback is really not correct.

I'll keep this open, we'll see.

I feel like there is already a flaw ignoring them inside TypeTraverser because while some instanceof might make sens like UnionType or IntersectionType I'm not sure every instanceof make sens.

Personally my main issue was the fact that I replace a TypeTraverser by a simultaneously one in RuleLevelHelper https://github.com/phpstan/phpstan-src/pull/4210/changes#diff-9dace3387909be6cad5cfedf4087102d316daf48f31a033ae258ab119636035bR92 ending with lot of instanceof inside a SimultaneousTypeTraverser.

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.

2 participants