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

Drop special handling of constant references on enums #6995

Merged
merged 2 commits into from Nov 27, 2021
Merged

Conversation

weirdan
Copy link
Collaborator

@weirdan weirdan commented Nov 26, 2021

Internally enum cases are constants, and they should be resolved as such.

Fixes #6994

Internally enum cases are constants, and they should be resolved as
such.

Fixes #6994
@weirdan weirdan added the enum label Nov 26, 2021
@weirdan weirdan added this to the PHP 8.1 milestone Nov 26, 2021
@weirdan weirdan requested a review from orklah November 26, 2021 04:01
@weirdan weirdan added the release:fix The PR will be included in 'Fixes' section of the release notes label Nov 26, 2021
@orklah
Copy link
Collaborator

orklah commented Nov 26, 2021

Yeah, that code seems weird, const don't return enumcases

@weirdan weirdan marked this pull request as draft November 26, 2021 11:48
@weirdan
Copy link
Collaborator Author

weirdan commented Nov 26, 2021

const don't return enumcases

Well, cases are consts, but ClassLikes::getClassConstantType() already deals with that.

I'm a bit confused as the change I did shouldn't have fixed the test I added. Gotta spend some time debugging, so I'm putting this on hold for the time being.

@weirdan
Copy link
Collaborator Author

weirdan commented Nov 27, 2021

Turns out I actually needed to drop more code and add more tests 😆

@weirdan weirdan marked this pull request as ready for review November 27, 2021 02:49
@weirdan weirdan requested a review from orklah November 27, 2021 02:49
@weirdan weirdan merged commit 03aea28 into master Nov 27, 2021
@weirdan weirdan deleted the enum-constants branch November 27, 2021 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enum release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Psalm forbids external access to enum constants
2 participants