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

@var with type Closure(): list<HelloWorld> is not subtype of native type Closure(): array #12458

Open
janedbal opened this issue Jan 22, 2025 · 1 comment · May be fixed by phpstan/phpstan-src#3797
Labels
Milestone

Comments

@janedbal
Copy link
Contributor

Bug report

See snippet, I believe it is a subtype.

Code snippet that reproduces the problem

https://phpstan.org/r/2c5d933a-99ae-475f-a3ed-4130ef176df9

Expected output

No error.

Did PHPStan help you today? Did it make you happy in any way?

No response

@VincentLanglet
Copy link
Contributor

When debugging the error it seems to be more an error about pure closure.

It can be fixed this way
https://phpstan.org/r/c0679ca4-3f09-4961-8533-7d0354801237

The issue might be that the purity issue is not described in the error message, but I would say it's already weird to have the purity checked when the message talk about native type.

So I opened phpstan/phpstan-src#3797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants