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

Allow adding custom Macroable classes. #1629

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mathieutu
Copy link

Summary

Some packages, like Filament, implements their own version of the Macroable trait.
Spatie even made their own version.

This PR allow adding any macro class we want to detect in the config file.

Thanks,
Mathieu.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • Existing tests have been adapted and/or new tests have been added
  • Update the README.md
  • Code style has been fixed via composer fix-style

@mathieutu mathieutu marked this pull request as draft December 11, 2024 11:05
@mathieutu
Copy link
Author

mathieutu commented Dec 11, 2024

⚠️ This PR can't be merged as it, because of these lines:

$traits = collect($reflection->getTraitNames());
if ($traits->contains('Illuminate\Support\Traits\Macroable') || $class === EloquentBuilder::class) {

There are two problems with them:

  • We're not looking for traits recursively, contrary to what is done in the Generator. (Leads to bugs)
  • The Macroable class is hardcoded. (Topic of this PR)
  • (The code is dupplicated)

I'm ok to continue and make the changes.

However, could you tell me if you're interested in this or not?
If this PR will be closed anyway, I don't invest more time in it.

Thanks!

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.

1 participant