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

Enum specific type is coerced to more general scalar type when used in generics template #10275

Closed
KmeCnin opened this issue Dec 10, 2023 · 2 comments

Comments

@KmeCnin
Copy link
Contributor

KmeCnin commented Dec 10, 2023

Bug report

Given an enum of string Test::CONST_* when a variable typed like this is passed through a generic template, it lost its specific typing and is instead coerced to a generic string type.

Might be a duplicate of #9084 but not sure about it

Code snippet that reproduces the problem

https://phpstan.org/r/6322446c-cfa0-43d5-a526-aad71db61f43

Expected output

Expecting $bar to be a array<1|2>

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

Everyday :)

@ondrejmirtes
Copy link
Member

With bleeding edge enabled this is fixed in 1.10.49: https://phpstan.org/r/a209e8f0-d697-4c78-9ea1-25076a383a52

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 Jan 14, 2024
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

2 participants