Skip to content

less precise type when strict-types=1 after assign #12902

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

Closed
staabm opened this issue Apr 18, 2025 · 0 comments · Fixed by phpstan/phpstan-src#3945
Closed

less precise type when strict-types=1 after assign #12902

staabm opened this issue Apr 18, 2025 · 0 comments · Fixed by phpstan/phpstan-src#3945

Comments

@staabm
Copy link
Contributor

staabm commented Apr 18, 2025

Bug report

with strict-types=0
https://phpstan.org/r/a05146b2-c2bb-4a10-94f4-6c280e8b75ca

we see a more precise type as in comparison to strict-types=1
https://phpstan.org/r/cea4a4f4-c995-4fae-afa1-d24fce45cdb0

Code snippet that reproduces the problem

https://phpstan.org/r/cea4a4f4-c995-4fae-afa1-d24fce45cdb0

Expected output

no error - with strict-types=1 we should have at least same precision of types, but not less precise as with strict-types=0

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

No response

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

Successfully merging a pull request may close this issue.

1 participant