Closed vaurdan closed 2 weeks ago
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Do we want to refactor the plugin to also adhere to the PSR-4 spec?
That's an interesting question. Generally, I'd say that the more structured a project is, and the more well-known standards it follows, it's generally easier to work with for external contributors. In our case, this might not translate to any real advantages though, and classmap
seems pretty standard.
A couple of questions:
Do you think that the current change could be characterized as a breaking change?
Currently, as it is, not really. I have only changed the tests to be PSR-4 compliant, all the remaining code base currently has the same structure and filenames.
Do you think that switching to PSR-4 would be a breaking change?
I don't think it's a breaking change. Although we would need to change a bunch of file names, all the existing hooks would still function exactly as before, and the same for all the functionalities. The only way I can think of where it could be a breaking change is, if for some reason, someone would be requiring a file directly from the plugin. And I don't think this is something that anybody does, and definitely not something that we support.
Description
This PR implements the Composer autoload into the wp-parsely plugin, to avoid manually requiring all the necessary classes.
A few notes:
classmap
(see Composer documentation here). Since this requires an authoritive classmap to be generated each time we add a new class, I have created agen-autoload
composer command to take care of it.Motivation and context
Improve the quality, readability and maintenance of the plugin's codebase
How has this been tested?
Tested locally, and validated that the unit tests are working; and also validated that there are no issues on the plugin inside WordPress.
Summary by CodeRabbit
New Features
Utils
class that consolidates various utility functions for better organization and maintainability.Bug Fixes
Refactor
Utils
class, promoting better code organization.get_asset_info
function, streamlining the code structure.Chores