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

Wrong return type in enum static method example #88

Open
estebanthebad opened this issue Apr 19, 2022 · 2 comments
Open

Wrong return type in enum static method example #88

estebanthebad opened this issue Apr 19, 2022 · 2 comments

Comments

@estebanthebad
Copy link

From manual page: https://php.net/language.enumerations.static-methods


The return type of the static method should read 'Size' not 'static'.

Cheers!

@cmb69
Copy link
Member

cmb69 commented Apr 19, 2022

I don't see a particular reason to return static here, but if we change that, we should return self, not Size.

@estebanthebad
Copy link
Author

Hm ... . As far as I understand the topic, inheritance is not allowed on enumerations, but static is used to refer to the class/enumeration a static method was called upon. So I was bewildered to read static as return type, because in this code it never can be anything else than Size. Though it is correct, it made me rather doubt if I understand the topic correctly. Just my 2 cents. And yes, I agree, when not using the most general static, the general self is more apropriate than the specific Size.

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

No branches or pull requests

2 participants