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

Replace function files with module classes #247

Open
tobeycodes opened this issue Nov 4, 2024 · 2 comments
Open

Replace function files with module classes #247

tobeycodes opened this issue Nov 4, 2024 · 2 comments

Comments

@tobeycodes
Copy link
Member

https://github.com/10up/wp-scaffold/tree/trunk/themes/10up-theme/includes

We should be consistent with how we use actions/filters. Either we should use functions everywhere or classes everywhere.

@darylldoyle
Copy link
Collaborator

Thanks, @tobeycodes. I've added this to the Internal Tools working group agenda to be discussed. If you have any additional context/information that would be useful for those reviewing this, I'd greatly appreciate it if you could add it.

From my perspective, the issue here is that we have classes containing actions/filters, but then we also have functional PHP files containing actions/filters. The issue with mixing them is that:

  1. We end up with poorly organised code because engineers disagree about where the best place to put them is.
  2. Mixing functional and OOP code can be confusing when we could use OOP for everything.
  3. Having one or the other would make it easier to implement tests across projects/the scaffold as we'd need less manual loading.

Is there anything there you think I've missed?

@tobeycodes
Copy link
Member Author

@darylldoyle Summed up perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants