-
Notifications
You must be signed in to change notification settings - Fork 42
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
PSR4 & Class Map Autoloading #704
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Since we're changing the namespace of a few classes (other than the usual version change), do you think this needs to be in a major version?
Or to make it backwards compatible we could set up class aliases just for the namespaces that we changed. For example, the Country_Helper
class:
- namespace SkyVerge\WooCommerce\PluginFramework\v5_13_1;
+ namespace SkyVerge\WooCommerce\PluginFramework\v5_13_1\Handlers;
@agibson-godaddy Good catch, I forgot I changed the namespace for Usually a namespace change like that should be a major version release as it is a breaking change, but in this case, this class (as far as I can tell) has been introduced recently (by you I believe) and been only used in one plugin. Do you think it worth the additional effort of adding a class alias? |
@nmolham-godaddy There were actually two namespace changes here:
If it were just the context checker, then I think I'd agree with you. But |
Good catch @agibson-godaddy, I got them mixed up as you concluded. I will setup class aliases for them. Done 3fb89fa let me know what you think I am playing around not with using |
Just testing the latest changes on Memberships plugin (https://github.com/gdcorp-partners/woocommerce-memberships/pull/1222) and it looks pretty good, no issues or error so far. It required tiny change, other than that, looks good to me |
I did a dump of composer loader final computed PSR4 and class mapping in runtime, and find a very promising results. As far as I can tell, all framework classes counted for and mapped correctly to proper class files 🕺 🕺 🕺 🕺 🕺 🕺 🕺
|
# Conflicts: # tests/unit/Helpers/CountryHelperTest.php # tests/unit/Payment_Gateway/PaymentFormContextCheckerTest.php # woocommerce/Handlers/Country_Helper.php # woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php # woocommerce/payment-gateway/PaymentFormContextChecker.php
# Conflicts: # tests/unit/Helpers/CountryHelperTest.php # tests/unit/Payment_Gateway/PaymentFormContextCheckerTest.php # woocommerce/Handlers/Country_Helper.php # woocommerce/payment-gateway/Blocks/Gateway_Blocks_Handler.php # woocommerce/payment-gateway/PaymentFormContextChecker.php
Replace base PR with the new release branch PR #705 |
Completed authorize[.]net gateway testing. Seems to work just fine! |
When I have both authorizenet and memberships activated at the same time, I get this error:
EDIT: fixed 68da0a5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @nmolham-godaddy ! I've done QA with both plugins separately, and with them activated at the same time. I believe everything is working as expected.
Not merging just so you can have a chance to look at my changes above. But I think we can go ahead and merge this.
Cool, thanks @agibson-godaddy for doing the QA and catching this bug caused by the class aliases, I definitlly didn't count for that one. |
Summary
Setup and configure PSR4 autoloading as well as class map existing matching class files.
Release: #705
QA
Before merge