Permalink
Browse files

[ClassLoader] added missing support for PHP 5.4 traits

  • Loading branch information...
1 parent 5828147 commit ddc88875d1dbcad4587db87bedaad1a9d9e614fc @fabpot fabpot committed Jul 3, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 ClassCollectionLoader.php
@@ -42,9 +42,14 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive =
self::$loaded[$name] = true;
+ $declared = array_merge(get_declared_classes(), get_declared_interfaces());
+ if (function_exists('get_declared_traits')) {
+ $declared = array_merge($declared, get_declared_traits());
+ }
+
if ($adaptive) {
// don't include already declared classes
- $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
+ $classes = array_diff($classes, $declared);
// the cache is different depending on which classes are already declared
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);

0 comments on commit ddc8887

Please sign in to comment.