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

Proper usage of the callable lifetime tags should be enforced in static analysis #10900

Open
stof opened this issue Apr 18, 2024 · 1 comment

Comments

@stof
Copy link
Contributor

stof commented Apr 18, 2024

Feature request

If @param-immediately-invoked-callable is applied on a parameter, storing the callable for later usage should report an error about this invalid usage.
Similarly, if @param-later-invoked-callable is applied on a parameter, invoking the callable immediately should report an error.

Based on the report in https://phpstan.org/r/dbc4145a-d59d-46a5-9848-2e3258f3b10d, this is not implemented yet.

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

No response

@phpstan-bot
Copy link
Contributor

@stof After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:

@@ @@
-11: PHPDoc tag @param for parameter $c with type callable is not subtype of native type Closure.
+No errors

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

No branches or pull requests

3 participants