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

hrtime() result is always int on 64-bit #3650

Closed
dktapps opened this issue Jul 21, 2020 · 4 comments
Closed

hrtime() result is always int on 64-bit #3650

dktapps opened this issue Jul 21, 2020 · 4 comments

Comments

@dktapps
Copy link
Contributor

dktapps commented Jul 21, 2020

Bug report

hrtime() has a platform-dependent return type: on 32-bit, hrtime(true) returns float, but on 64-bit it returns int.

Code snippet that reproduces the problem

https://phpstan.org/r/b72181f9-ad67-4b9c-b201-43b362fff064

Expected output

No error.

Additional notes

It might be a good idea to read composer.json to check for php-64bit requirement, or have some phpstan.neon flag that allows specifying the arch, because this is not the only thing that has arch-dependent behaviour (for example https://phpstan.org/r/f64df3f6-d49d-4f09-b70a-f18e85182b8f).

@ondrejmirtes
Copy link
Member

This is too much of an edge-case, not gonna fix it.

@simPod
Copy link
Contributor

simPod commented Nov 28, 2020

In what way it is an edge-case? With every usage of hrtime() phpstan thinks that return type is float|int. I believe that nowadays it is int in 99 % cases.

@ondrejmirtes
Copy link
Member

In the sense that I don't want PHPStan to care about 32-bit vs. 64-bit. But I actually fixed the false positive: phpstan/phpstan-src@2a39e5a

@github-actions
Copy link

github-actions bot commented May 5, 2021

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 May 5, 2021
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