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

Negative literal number not recognized in namespace #4663

Closed
thomasvargiu opened this issue Nov 22, 2020 · 1 comment · Fixed by #6064
Closed

Negative literal number not recognized in namespace #4663

thomasvargiu opened this issue Nov 22, 2020 · 1 comment · Fixed by #6064
Labels

Comments

@thomasvargiu
Copy link
Contributor

When using a literal negative number as param type, Psalm doesn't recognized it throwing an error.

https://psalm.dev/r/9aa91865eb

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/9aa91865eb
<?php

namespace n;

class Foo {
    /**
     * @param -1|0|1 $i
     */
    public static function takeValue($i): int {
        return $i;
    }
}
Psalm output (using commit 2c77424):

ERROR: InvalidDocblock - 7:15 - Unrecognized type n\-1 in docblock for n\Foo::takeValue

INFO: MixedReturnStatement - 10:16 - Could not infer a return type

INFO: MissingParamType - 9:38 - Parameter $i has no provided type

INFO: MixedInferredReturnType - 9:43 - Could not verify return type 'int' for n\Foo::takeValue

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

Successfully merging a pull request may close this issue.

2 participants