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

False positive for class-string<self> #2941

Closed
gharlan opened this issue Mar 8, 2020 · 1 comment
Closed

False positive for class-string<self> #2941

gharlan opened this issue Mar 8, 2020 · 1 comment
Labels

Comments

@gharlan
Copy link
Contributor

gharlan commented Mar 8, 2020

https://psalm.dev/r/240410c30c

@psalm-github-bot
Copy link

psalm-github-bot bot commented Mar 8, 2020

I found these snippets:

https://psalm.dev/r/240410c30c
<?php

class Foo
{
    /** @var array<string, class-string<self>> */
    private static $classes;
    
    /**
     * @param class-string<self> $class
     */
    public static function register(string $key, string $class): void
    {
        self::$classes[$key] = $class;
    }
}
Psalm output (using commit 8926f1d):

ERROR: InvalidPropertyAssignmentValue - 13:9 - Foo::$classes with declared type 'array<string, class-string<self>>' cannot be assigned type 'non-empty-array<string, class-string<Foo>|class-string<self>>'

@muglug muglug added the bug label Mar 9, 2020
@muglug muglug closed this as completed in 3243819 Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants