Open crtl opened 1 year ago
Hey @crtl, can you reproduce the issue on https://psalm.dev ?
In the stacktrace # 11 / 12 gives the file in which you have an incorrect/maleformed docblock comment (seems like it is a class method docblock). Fix that and the issue should go away. If not, provide us with the code in question and we'll try to help you from there.
@ygottschalk Thanks for the reply. I have never used Psalm before. Shouldnt it show me which docblock is incorrect?
Anyways ive resolved the issue by running init with the --debug
flag which shows what file is causing the issue.
The docbloc in question had the following format:
public function __construct(
/**
* @var $varName Type[]
*/
protected array $varName,
) {}
but should be
public function __construct(
/**
* @var Type[]
*/
protected array $varName,
) {}
Psalm should catch those Exceptions, if nothing more to say "Run with --debug-by-line" to know where Psalm failed and create an issue if needed on github" or something like that
@ygottschalk Thanks for the reply. I have never used Psalm before. Shouldnt it show me which docblock is incorrect?
Yes it should and in "usual / normal" mode it does (see: https://psalm.dev/r/88965cbfc5). Seems to be an issue with the --init
flag / mode.
The syntax used for the @var
annotation used by psalm is the other way around like you used it (see example above) and is the "standard" phpdoc syntax (see also: https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#518-var)
I found these snippets:
After installing psalm and trying to init it throws an IncorrectDocblocException: