Skip to content

Conversation

@dipesh79
Copy link

When making enum using artisan command, it add the enum inside app directory and this PR makes it inside app/Enums directory

@crynobone
Copy link
Member

the command already generate to app/Enums if the directory exists.

@dipesh79
Copy link
Author

@crynobone It will only if the Enums directory is available.

Comment on lines 73 to +75
is_dir(app_path('Enums')) => $rootNamespace.'\\Enums',
is_dir(app_path('Enumerations')) => $rootNamespace.'\\Enumerations',
default => $rootNamespace,
default => $rootNamespace.'\\Enums',
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't is_dir(app_path('Enums')) and default now redundant?

@shaedrich
Copy link
Contributor

the command already generate to app/Enums […] [but] only if the Enums directory is available.

Yeah, that seems weird. Why not just create the directory 🤷🏻 Would have been my logical conclusion ("principle of least surprise") as well.

Isn't that what is done for other classes in Laravel?

Also, it seems weird so have to check this via match instead of putting "Enums/" in some config file as a default, so it can be changed there if needed.

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.

4 participants