Permalink
Browse files

[ClassLoader] added support for PHP 5.4 traits

  • Loading branch information...
1 parent 33066c1 commit 2f6e0035ead182649d561e310baae808f822b3ea @fabpot fabpot committed Sep 22, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 ClassCollectionLoader.php
  2. +1 −1 DebugUniversalClassLoader.php
@@ -84,7 +84,7 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive =
$files = array();
$content = '';
foreach ($classes as $class) {
- if (!class_exists($class) && !interface_exists($class)) {
+ if (!class_exists($class) && !interface_exists($class) && function_exists('trait_exists') && !trait_exists($class)) {
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
}
@@ -54,7 +54,7 @@ public function loadClass($class)
if ($file = $this->findFile($class)) {
require $file;
- if (!class_exists($class, false) && !interface_exists($class, false)) {
+ if (!class_exists($class, false) && !interface_exists($class, false) && function_exists('trait_exists') && !trait_exists($class)) {
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
}

0 comments on commit 2f6e003

Please sign in to comment.