Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
[ClassLoader] added support for PHP 5.4 traits
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 22, 2011
1 parent 33066c1 commit 2f6e003
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ClassCollectionLoader.php
Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion DebugUniversalClassLoader.php
Expand Up @@ -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));
}
}
Expand Down

0 comments on commit 2f6e003

Please sign in to comment.