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

Psalm don't analyze unused traits #10920

Open
vjik opened this issue Apr 25, 2024 · 1 comment
Open

Psalm don't analyze unused traits #10920

vjik opened this issue Apr 25, 2024 · 1 comment

Comments

@vjik
Copy link
Contributor

vjik commented Apr 25, 2024

Without "use" no issues: https://psalm.dev/r/6d64d83015

With "use" has issues: https://psalm.dev/r/c174834679

Copy link

I found these snippets:

https://psalm.dev/r/6d64d83015
<?php

trait ArrayableTrait
{
    public function fields(): array
    {
        return UnknownFn();
    }
}
Psalm output (using commit 08afc45):

No issues!
https://psalm.dev/r/c174834679
<?php

trait ArrayableTrait
{
    public function fields(): array
    {
        return UnknownFn();
    }
}

class Test {
    use ArrayableTrait;
}
Psalm output (using commit 08afc45):

ERROR: UndefinedFunction - 7:16 - Function UnknownFn does not exist

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

No branches or pull requests

1 participant