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

Enums instead constants #10038

Open
l-you opened this issue Sep 11, 2022 · 3 comments
Open

Enums instead constants #10038

l-you opened this issue Sep 11, 2022 · 3 comments

Comments

@l-you
Copy link

l-you commented Sep 11, 2022

Do you plan to replace constants with native enums in v3.0?
For instance in mappings

* @var string
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/
public $fetch = 'LAZY';

@l-you l-you changed the title Enums instead contants Enums instead constants Sep 11, 2022
@michnovka
Copy link
Contributor

@derrabus @greg0ire @beberlei Id like to open a discussion under this thread. I think this is the way to go in the future, are there any cases against?

@derrabus
Copy link
Member

derrabus commented Oct 19, 2022

The only argument against this plan that comes to my mind is that we would force people to update code that is perfectly fine. I'm currently modernizing our attribute classes (see #10145, #10151) and exploring how we can leverage enums is on my todo list.

@michnovka
Copy link
Contributor

michnovka commented Oct 19, 2022

@derrabus perhaps we could leverage https://github.com/rectorphp/rector and make rules that would update the code automatically?

Edit: ah, I see this is a thing - https://github.com/rectorphp/rector-doctrine

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

3 participants