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

[PHP 8.1] Access to an undefined property BackedEnum::$name #6385

Closed
ruudk opened this issue Jan 17, 2022 · 6 comments
Closed

[PHP 8.1] Access to an undefined property BackedEnum::$name #6385

ruudk opened this issue Jan 17, 2022 · 6 comments

Comments

@ruudk
Copy link
Contributor

ruudk commented Jan 17, 2022

Bug report

Given that #6048 was closed (and updated with mentions about Enum's being supported in 1.3) I thought I was good to create a new issue for this.

Somehow PHPStan doesn't understand that you can access $name on BackedEnum.

Code snippet that reproduces the problem

https://phpstan.org/r/5b07429c-74f8-40b1-9e4f-68cd3e20f839

Expected output

No error, as the code just works on PHP 8.1

@ruudk
Copy link
Contributor Author

ruudk commented Jan 17, 2022

@ondrejmirtes What's the best way to solve this? Adding it to a stub somewhere? I can provide the PR right-away.

@ondrejmirtes
Copy link
Member

Yeah, this one is funny :) UnitEnum and BackedEnum are actually the only interfaces ever that contain properties. And what's worse, they aren't even actually enums. Which is breaking some logic down somewhere. I'm gonna look into it.

@ondrejmirtes
Copy link
Member

Here: Roave/BetterReflection#971

Gonna integrate it in my fork right away.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@67d3a88

@ruudk
Copy link
Contributor Author

ruudk commented Jan 17, 2022

Thank you ⚡

@github-actions
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 Feb 18, 2022
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