Skip to content

Conversation

@felipeArnold
Copy link

Within the commands defined in the structure there is currently no option to create enums, whenever I create a new project I need to create a custom command to create enums, the same applies to external actions and services.

For example: when I need to create an action, I created a make:action command.
For an external service, for integrations with other products I generally use a make:service command.

In this case, I always need to create a new command to create enums, I believe that make:enum would be very useful for Laravel developers' daily lives.

php artisan make:enum

Att. Felipe Arnold.


namespace {{ namespace }};

enum {{ class }}: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only a string and not an int?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the int|string suggestion?

@rojtjo
Copy link
Contributor

rojtjo commented Feb 7, 2024

This has been attempted a few times already.

See: #49751 #48644

@devajmeireles
Copy link
Contributor

  1. This should wait for this - probably targeting 11.x
  2. The correct thing to do is to create a generic enum, without type.

@devajmeireles
Copy link
Contributor

devajmeireles commented Feb 7, 2024

This has been attempted a few times already.

See: #49751 #48644

Maybe after this, the idea here can be merged.

*
* @return void
*/
protected function createTest()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum will not need tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? I think testing enums are fairly commonplace.

@driesvints driesvints changed the title Create new command EnumMakeCommand. [10.x] Create new command EnumMakeCommand Feb 8, 2024
@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

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

Successfully merging this pull request may close these issues.

6 participants