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

Hability to blacklist static methods #39

Closed
gjm opened this issue Apr 2, 2020 · 6 comments
Closed

Hability to blacklist static methods #39

gjm opened this issue Apr 2, 2020 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@gjm
Copy link

gjm commented Apr 2, 2020

I know this issue has been discussed in spatie/enum#28 but with the recent addition of the Castable interface in Laravel I believe this needs to be revised.

I've created custom casters to Enum classes and would like to be able to make them implement the Castable interface which required a public static castUsing() method.

Currently this is impossible with Enum classes because static methods are assumed to be enum values. An @ignoreEnum doc annotation, like suggested in the issue, would solve this while still maintaining backwards compatibility.

@Gummibeer Gummibeer self-assigned this Apr 2, 2020
@Gummibeer Gummibeer transferred this issue from spatie/enum Apr 2, 2020
@Gummibeer Gummibeer added the question Further information is requested label Apr 2, 2020
@Gummibeer
Copy link
Collaborator

Hey, I've transferred the issue to the laravel-enum package because your usecase applies to the Laravel implementation.
Because this specific usecase will be solved by #31 I still don't see the point to allow custom static methods on an enum class.
For this specific case we will check for the interface implementation and ignore the castUsing() method.

This will be done on a new Enum class in this laravel-enum package because it's an optional and Laravel specific case.

@gjm
Copy link
Author

gjm commented Apr 2, 2020

@Gummibeer OK, I'll be watching. Thanks.

@brendt
Copy link
Collaborator

brendt commented Apr 3, 2020

Can I pitch in? I think Castable should be supported by this package, as soon as Laravel's new version is tagged. I wouldn't support a blacklist.

@gjm
Copy link
Author

gjm commented Apr 3, 2020

@brendt I agree. It's already available in 7.4.0.

@brendt
Copy link
Collaborator

brendt commented Apr 3, 2020

There's still a pending PR that would be needed for this to work: laravel/framework#32213

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants