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

Use WP Autoloader class #1051

Merged
merged 9 commits into from
Dec 9, 2024
Merged

Use WP Autoloader class #1051

merged 9 commits into from
Dec 9, 2024

Conversation

obenland
Copy link
Member

@obenland obenland commented Dec 6, 2024

This is one of those changes I'm on the fence about as it doesn't strictly improve things, it just makes them "different".
The Autoloader class proposed here is based on Dion's work for the WP.org Plugin Directory and used in its proposed form in the /lib/atomic-v2 library on Dotcom.

I was positively surprised that it seems to just be a drop-in replacement for the current Autoloader, which I didn't quite expect :)
It currently lacks the debug log for when a class is not readable or couldn't be loaded. Was that triggered at any point before?

Proposed changes:

  • Replaces inline Autoloader with a separate Autoloader class that can be re-used.
  • Moves the integrations loader to be included with the other includes.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Make sure everything still works?

@obenland obenland added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Dec 6, 2024
@obenland obenland requested a review from a team December 6, 2024 20:46
@obenland obenland self-assigned this Dec 6, 2024
@obenland obenland mentioned this pull request Dec 6, 2024
1 task
pfefferle
pfefferle previously approved these changes Dec 7, 2024
Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

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

I like it and it looks way cleaner

@obenland obenland marked this pull request as ready for review December 9, 2024 14:49
@pfefferle
Copy link
Member

Maybe escaping the global functions!?!

includes/class-autoloader.php Outdated Show resolved Hide resolved
activitypub.php Outdated Show resolved Hide resolved
@obenland
Copy link
Member Author

obenland commented Dec 9, 2024

Maybe escaping the global functions!?!

What do you mean with that?

@pfefferle
Copy link
Member

Why have I used "escape" and I have no idea how it is called 🫣... I mean \spl_autoload_register instead of spl_autoload_register.

@obenland obenland merged commit f0ebe33 into trunk Dec 9, 2024
24 checks passed
@obenland obenland deleted the update/autoloader branch December 9, 2024 15:26
obenland added a commit that referenced this pull request Dec 9, 2024
obenland added a commit that referenced this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants