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

Invalid assumptions about non-deterministic functions #7529

Closed
Kolyunya opened this issue Jun 24, 2022 · 5 comments
Closed

Invalid assumptions about non-deterministic functions #7529

Kolyunya opened this issue Jun 24, 2022 · 5 comments

Comments

@Kolyunya
Copy link
Contributor

Bug report

PHPStan incorrectly assumes that the second call to a non-deterministic function would yield the same result.

Code snippet that reproduces the problem

https://phpstan.org/r/fb5391d6-50fb-4378-9c11-3306b911055f

Expected output

No issues should be reported.

Did PHPStan help you today? Did it make you happy in any way?

PHPStan helps me every single day. Love you guys!

@rvanvelzen
Copy link
Contributor

@ondrejmirtes
Copy link
Member

There's a new not-yet released option called rememberPossiblyImpureFunctionValues that defaults to true but with false you won't need to mark such functions as impure: phpstan/phpstan-src@50ed38f

It's going to be released soon.

@Kolyunya
Copy link
Contributor Author

Kolyunya commented Jun 24, 2022

@rvanvelzen thanks for a hint, but I can not mark it. This is a 3rd party function.

@ondrejmirtes
Copy link
Member

@Kolyunya You still can: https://phpstan.org/user-guide/stub-files

But if I were you, I'd just wait for a new PHPStan release and used 1.7.x-dev meanwhile.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants