-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Requests_Auth: change to namespaced interface
Includes: * Moving the namespaced version of the interface to the `src` directory. * [Custom autoload] Adding the interface to the `$deprecated_classes` array in the `WpOrg\Requests\Autoload` class. * [Composer autoload] Adding the interface to a new `Deprecated.php` file. Same as the custom autoloader when encountering deprecated classes, loading this file will also trigger a deprecation notice. And again, same as the custom autoloader, the deprecation notice can be silenced by setting a `REQUESTS_SILENCE_PSR0_DEPRECATIONS` constant. * Adding the new `Deprecated.php` file to the Composer `autoload` directive to be indexed to a classmap. * Updating all references to the interface.
- Loading branch information
Showing
7 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Backwards compatibility layer for Requests. | ||
* | ||
* Allows for Composer to autoload the old PSR-0 class names based on a classmap. | ||
* | ||
* All classes in this file are deprecated. | ||
* Please see the Changelog for the 2.0.0 release for upgrade notes. | ||
* | ||
* @package Requests | ||
* | ||
* @deprecated 2.0.0 Use the PSR-4 class names instead. | ||
*/ | ||
|
||
/* | ||
* Integrators who cannot yet upgrade to the PSR-4 class names can silence deprecations | ||
* by defining a `REQUESTS_SILENCE_PSR0_DEPRECATIONS` constant and setting it to `true`. | ||
* The constant needs to be defined before the first deprecated class is requested | ||
* via this Composer autoload file. | ||
*/ | ||
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS') || REQUESTS_SILENCE_PSR0_DEPRECATIONS !== true) { | ||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error | ||
trigger_error( | ||
'The PSR-0 `Requests_...` class names in the Request library are deprecated.' | ||
. ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.', | ||
E_USER_DEPRECATED | ||
); | ||
} | ||
|
||
interface Requests_Auth extends WpOrg\Requests\Auth {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters