diff --git a/examples/preload-aliases.php b/examples/preload-aliases.php new file mode 100644 index 000000000..8af35e6a1 --- /dev/null +++ b/examples/preload-aliases.php @@ -0,0 +1,31 @@ + $new) { + // Make sure we don't get "Class already exists errors" from autoloading chains + // Think: an `implements` causing an interface to be loaded before we explicitly request it. + if (class_exists($old) === false && interface_exists($old) === false) { + WpOrg\Requests\Autoload::load($old); + } +} diff --git a/src/Autoload.php b/src/Autoload.php index 26dd280ee..25a463a5b 100644 --- a/src/Autoload.php +++ b/src/Autoload.php @@ -183,5 +183,14 @@ public static function load($class_name) { return false; } + + /** + * Get the array of deprecated Requests 1.x classes mapped to their equivalent Requests 2.x implementation. + * + * @return array + */ + public static function get_deprecated_classes() { + return self::$deprecated_classes; + } } }