-
Notifications
You must be signed in to change notification settings - Fork 659
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 ignores functions with certain @since
annotations, and then reports a ParseError
#10761
Comments
I found these snippets: https://psalm.dev/r/b16dc9cdc5<?php
class Foo {
/**
* @since 8.9.9
*/
public function bar() {
}
}
|
Yeah, this is something that has annoyed me before too. For any analyzed code, including user provided stubs, the @SInCE tag should be ignored, I'd say. |
… for @SInCE 8.0.0 PHP Fix vimeo#10761
… for @SInCE 8.0.0 PHP Fix vimeo#10761
… for @SInCE 8.0.0 PHP Fix vimeo#10761
Added a PR to only use @SInCE for php version in .phpstub files and if Now only the |
It seems that Psalm is interpreting a
@since
docblock annotation, when the value matches/^[4578]\.\d(\.\d+)?$/
, as indicating a PHP version (ref) and ignores the function definition if the value is newer than (a mangled version of1) the value of--php-version
or<psalm phpVersion>
(ref1, ref2).Then, since the function was ignored, Psalm later reports a ParseError about "$storage should not be null" because it doesn't know anything about the function (cf. #9672 (comment)).
This interferes with the common (and documented) use of
@since
to indicate the version of the project in which a function was added.See https://psalm.dev/r/b16dc9cdc5 for an example.
Footnotes
Due to another bug in the code (here and here), it interprets any phpVersion "8.x" as if it were "8.8", any "7.x" as if it were "7.7", and so on. ↩
The text was updated successfully, but these errors were encountered: