Skip to content
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

Fix CallMap for Reflection(Union|Intersection)Type::getTypes() #9084

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BenMorel
Copy link
Contributor

@BenMorel BenMorel commented Jan 8, 2023

Trying to fix #9079, I looked at stubs as advised in #9079 (comment):

Reflection classes were added in stubs (which overrides callmap) recently, so you may need to dig into that instead

But the correct type was already there:

    class ReflectionUnionType extends ReflectionType {
        /** @return non-empty-list<ReflectionNamedType|ReflectionIntersectionType> */
        public function getTypes(): array {}
    }

https://github.com/vimeo/psalm/blob/5.4.0/stubs/Php82.phpstub

So just in case, I tried to fix the CallMaps as well (this PR), but Psalm still reports the same false positive with the code in the original issue:

docblock-defined type ReflectionNamedType does not contain ReflectionIntersectionType

Any idea?

@orklah
Copy link
Collaborator

orklah commented Jan 9, 2023

The issue seems to come from a wrong order when Psalm loads stubs. On my computer, the PHP80 stub is loaded last. We had a discussion about the way those stubs are loaded here: #8722 (comment)

I think we introduced (or revealed) an issue here.

Could you try to take a look at how those stubs are loaded to see if we can restore the correct order?

/cc @weirdan @Ocramius

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.

Allow DNF types in ReflectionUnionType::getTypes()
2 participants