-
Notifications
You must be signed in to change notification settings - Fork 493
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
Autoload: introduce method get_deprecated_classes()
.
#681
Autoload: introduce method get_deprecated_classes()
.
#681
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.
@alpipego Looks like the example file mentioned in #659 (comment) is missing. Did you forget to push a second commit ?
266eeff
to
06fd968
Compare
Sorry, I amended my commit but didn't add the file. It's there now. |
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.
Thanks @alpipego for getting this set up!
Generally looks good to me.
I do think the example file should be renamed though as this is not about the "normal" autoloading, but about preloading the Requests 1.x class names.
06fd968
to
f9c888a
Compare
Thank you for your notes, @jrfnl. |
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.
@alpipego Thanks for the update! And yes, in this case, amending the commits is perfectly fine and makes for a clean commit history, so all good 👍🏻
Aside from the inline remark, there is only one other thing:
What about adding a very simple test for the method. I understand if it feels redundant as there is no logic in the Autoload::get_deprecated_classes()
method, but then again, there are also no other safeguards like a type declaration or code within the library calling the method.
So what about a simple test just calling the method and verifying that the returned value is an array and has # number of elements ?
This method will return the array for the class mapping between the legacy classes and their namespaced 2.x counterparts. The need for this change came up while using the 2.x version of the library together with a framework or CMS, that includes a 1.x version of Requests. In order to prevent the framework from autoloading the 1.x classes, they must be aliased before accessed. Through exposing the mapping array, the classes can be aliased before being their implementations get loaded. See WordPress#659
f9c888a
to
7a50b58
Compare
I have amended my commit:
|
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.
@alpipego Thanks for the update. Looks good to go to me! I'll give @schlessera a chance to look it over too, but as far as I'm concerned: let's merge this!
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
This method will return the array for the class mapping between the
legacy classes and their namespaced 2.x counterparts. The need for this
change came up while using the 2.x version of the library together
with a framework or CMS, that includes a 1.x version of Requests.
In order to prevent the framework from autoloading the 1.x classes,
they must be aliased before accessed. Through exposing the mapping
array, the classes can be aliased before being their implementations
get loaded.
See #659
Pull Request Type
This is a:
Context
Detailed Description
This adds the method
\WpOrg\Requests\Autoload::get_deprecated_classes
to access the class mapping from v1 to v2 and load the classes before\WP_Http
gets the chance to do so.Quality assurance
Documentation
For new features:
examples
directory.docs
directory.If the documentation is in a new markdown file, I have added a link to this new file to the Docs folder
README.md
file.