From ad5a352e894442c5188195f4f8fb12fe05a9e621 Mon Sep 17 00:00:00 2001 From: Greg Sherwood Date: Tue, 9 May 2017 15:50:54 +1000 Subject: [PATCH] The autoloader is now working correctly with classes created with class_alias() (ref #1452) --- autoload.php | 6 +++--- package.xml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload.php b/autoload.php index 6c35bbff4f..3a97664679 100644 --- a/autoload.php +++ b/autoload.php @@ -156,7 +156,7 @@ public static function loadFile($path) include $path; $className = null; - $newClasses = array_diff(get_declared_classes(), $classes); + $newClasses = array_reverse(array_diff(get_declared_classes(), $classes)); foreach ($newClasses as $name) { if (isset(self::$loadedFiles[$name]) === false) { $className = $name; @@ -165,7 +165,7 @@ public static function loadFile($path) } if ($className === null) { - $newClasses = array_reverse(array_diff(get_declared_traits(), $classes)); + $newClasses = array_reverse(array_diff(get_declared_interfaces(), $classes)); foreach ($newClasses as $name) { if (isset(self::$loadedFiles[$name]) === false) { $className = $name; @@ -175,7 +175,7 @@ public static function loadFile($path) } if ($className === null) { - $newClasses = array_reverse(array_diff(get_declared_interfaces(), $classes)); + $newClasses = array_reverse(array_diff(get_declared_traits(), $classes)); foreach ($newClasses as $name) { if (isset(self::$loadedFiles[$name]) === false) { $className = $name; diff --git a/package.xml b/package.xml index bb40590a3e..3c14e06d26 100644 --- a/package.xml +++ b/package.xml @@ -30,6 +30,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - PHPCS now stops looking for a phpcs.xml file as soon as one is found, favoring the closest one to the current dir - Added missing help text for the --stdin-path CLI option to --help - The Squiz standard now enforces short array syntax by default + - The autoloader is now working correctly with classes created with class_alias() - Fixed bug #1442 : T_NULLABLE detection not working for nullable parameters and return type hints in some cases - Fixed bug #1447 : Running the unit tests with a phpunit config file breaks the test suite -- Unknown arguments were not being handled correctly, but are now stored in $config->unknown