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: cases are constants #6471

Closed
3 tasks done
Tracked by #6425
weirdan opened this issue Sep 10, 2021 · 1 comment
Closed
3 tasks done
Tracked by #6425

Enum: cases are constants #6471

weirdan opened this issue Sep 10, 2021 · 1 comment

Comments

@weirdan
Copy link
Collaborator

weirdan commented Sep 10, 2021

Psalm should

@weirdan weirdan added this to the PHP 8.1 milestone Sep 10, 2021
@psalm-github-bot
Copy link

psalm-github-bot bot commented Sep 10, 2021

I found these snippets:

https://psalm.dev/r/30e59100be
<?php

enum E {
    const A = 1;
    case A;
}
Psalm output (using commit f496cca):

No issues!
https://psalm.dev/r/838acc5287
<?php

enum E {
    const A = 1;
    case B;
}

/** @return E::* */
function f(): mixed {
    return E::B;
}
Psalm output (using commit f496cca):

ERROR: InvalidReturnStatement - 10:12 - The inferred type 'enum(E::B)' does not match the declared return type '1' for f

ERROR: InvalidReturnType - 8:13 - The declared return type '1' for f is incorrect, got 'enum(E::B)'

@weirdan weirdan mentioned this issue Sep 10, 2021
15 tasks
@orklah orklah added the enum label Nov 6, 2021
weirdan added a commit to weirdan/psalm that referenced this issue Nov 10, 2021
weirdan added a commit to weirdan/psalm that referenced this issue Nov 28, 2021
@weirdan weirdan closed this as completed Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants