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

Callmap return value non-empty-string not working for uniqid? #9839

Closed
kkmuffme opened this issue May 30, 2023 · 4 comments · Fixed by #9842
Closed

Callmap return value non-empty-string not working for uniqid? #9839

kkmuffme opened this issue May 30, 2023 · 4 comments · Fixed by #9842

Comments

@kkmuffme
Copy link
Contributor

https://psalm.dev/r/076fdabdb7

psalm's CallMap.php has a return type of "non-empty-string" specified, why does it say "string" in the trace though?

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/076fdabdb7
<?php

$x = uniqid();
/** @psalm-trace $x */;
Psalm output (using commit 2bbfca6):

INFO: Trace - 4:23 - $x: string

INFO: UnusedVariable - 3:1 - $x is never referenced or the value is not used

@orklah
Copy link
Collaborator

orklah commented May 30, 2023

Stubs take priority to callmap:

function uniqid(string $prefix = "", bool $more_entropy = false) : string {}

This is an oversight that was made when adding taint support for this function

It would be cool if we had tests that checks that you can't have types more specific in callmaps than in stubs

@kkmuffme
Copy link
Contributor Author

It would be cool if we had tests that checks that you can't have types more specific in callmaps than in stubs

Could you create a separate issue for that?

@orklah
Copy link
Collaborator

orklah commented May 30, 2023

Done

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

Successfully merging a pull request may close this issue.

2 participants