Skip to content

Fix ClassMetadaInfo template inference#8708

Merged
greg0ire merged 1 commit intodoctrine:2.9.xfrom
VincentLanglet:patch-2
May 25, 2021
Merged

Fix ClassMetadaInfo template inference#8708
greg0ire merged 1 commit intodoctrine:2.9.xfrom
VincentLanglet:patch-2

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

Hi @greg0ire, I saw you fixed some psalm issue recently
6de321c

Currently the following code

    /**
     * @phpstan-template T of object
     * @phpstan-param class-string<T> $class
     * @phpstan-return ClassMetadata<T>
     */
    private function getMetadata(string $class): ClassMetadata
    {
        return new ClassMetadata($class);
    }

is not working, since new ClassMetadata($class) is inferred as ClassMetadata<object>.

Which lead to weird static analysis issue in 2.8.5 release.

I fix this in this PR.

@greg0ire
Copy link
Copy Markdown
Member

greg0ire commented May 24, 2021

I think 2.8.x is no longer maintained, or should not be, that's why I re-targeted this, let's see what happens to #8717

@greg0ire greg0ire merged commit 7ab2c3a into doctrine:2.9.x May 25, 2021
@greg0ire
Copy link
Copy Markdown
Member

Thanks @VincentLanglet !

@greg0ire greg0ire added this to the 2.9.2 milestone May 25, 2021
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