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

Issue with simplifying int|int #4349

Closed
orklah opened this issue Oct 16, 2020 · 2 comments
Closed

Issue with simplifying int|int #4349

orklah opened this issue Oct 16, 2020 · 2 comments
Labels

Comments

@orklah
Copy link
Collaborator

orklah commented Oct 16, 2020

Hi,

In the following code:
https://psalm.dev/r/2c669f0606

Psalm trips a little and think the right type is int|int. If we ask Psalter to fix the code, it will add a @return int|int but this will prevent adding the native return type

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/2c669f0606
<?php

function a(){
    $count = 0;
 	if(rand(0,1)){
        return 0;
    }
    
    $count++;
    return $count;
}
Psalm output (using commit 234eae6):

INFO: MissingReturnType - 3:10 - Method a does not have a return type, expecting int|int

@muglug muglug added the bug label Oct 16, 2020
@muglug muglug closed this as completed in be1cd52 Oct 16, 2020
@orklah
Copy link
Collaborator Author

orklah commented Oct 16, 2020

Thanks!

danog pushed a commit to danog/psalm that referenced this issue Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants