-
Notifications
You must be signed in to change notification settings - Fork 668
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
MissingPureAnnotation issues #4300
Comments
re: pure param annotation - it should be possible to specify it like this: https://psalm.dev/r/add7ac5ba4 |
I found these snippets: https://psalm.dev/r/add7ac5ba4<?php
/**
* @psalm-pure
* @param pure-Closure():int $c
*/
function f(Closure $c): int {
return $c();
}
echo f(function () { return rand(0,1); });
|
I see. That solves the last issue then. Thanks! |
A lot have changed since then. Could you check if the two first issues are still there? |
@orklah First issue is indeed solved. The second one is not. Even Psalm 4.19 is still trying to add |
I ran into some issues while running
--alter --issues=MissingPureAnnotation
. I created a repo to reproduce them:https://github.com/enumag/psalm-bug-2
output:
1) Docblock text
As you noticed psalm somehow doubled the whitespace and star before the docblock description.
2)
@psalm-pure
should not be addedBecause the
$callback
closure is not pure.3) Impossible to mark the callback as pure
I want to keep the callback as Closure only and it won't actually be pure. However I tried to mark it a pure anyway using
@param pure-callbable&Closure(mixed): array-key $callback
just to see if it's possible. But thenvendor/bin/psalm
fails with some false-positive:The text was updated successfully, but these errors were encountered: