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

psalter --issues=MissingParamType adds duplicate @param annotations #4192

Closed
caugner opened this issue Sep 16, 2020 · 5 comments
Closed

psalter --issues=MissingParamType adds duplicate @param annotations #4192

caugner opened this issue Sep 16, 2020 · 5 comments

Comments

@caugner
Copy link
Contributor

caugner commented Sep 16, 2020

I have observed several occurrences where psalter added duplicate @param annotations when there has already been an (invalid) @param annotation without a type. It would be nice if Psalm could reuse those annotations.

Before:

/**
 * @param $x
 */
function foo($x) {}

foo(true);
foo(false);

After:

/**
 * @param $x
 * @param bool $x
 */
function foo($x) {}

foo(true);
foo(false);

PS: This example is abstracted from what I observed.

@psalm-github-bot
Copy link

Hey @caugner, can you reproduce the issue on https://psalm.dev ?

@caugner
Copy link
Contributor Author

caugner commented Sep 16, 2020

Alternatively, @param $x should cause an InvalidDocblock issue:

https://psalm.dev/r/d560c42190

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/d560c42190
<?php

/**
 * @param $x
 */
function foo($x) {}
Psalm output (using commit dda013d):

INFO: MissingParamType - 6:14 - Parameter $x has no provided type

INFO: MissingReturnType - 6:10 - Method foo does not have a return type, expecting void

@stejes
Copy link

stejes commented Nov 16, 2022

I have the same issue, in my example:

     /**
     * @param null|string $search
     */
    private static function resolveFilter(string|null $search, array $columns, array &$errors): array

Both the typing in the phpdoc and the typing in the parameter list were absent before psalm --alter was run.

@orklah
Copy link
Collaborator

orklah commented Mar 3, 2023

Fixed by #9441

@orklah orklah closed this as completed Mar 3, 2023
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