Browse Source

Check if trait was loaded

tags/2.0.0-beta
Suralc 12 years ago
parent
commit
bac5c0e729
  1. 8
      framework/YiiBase.php

8
framework/YiiBase.php

@ -332,6 +332,11 @@ class YiiBase
*/
public static function autoload($className)
{
static $hasTraitFunctionality;
if($hasTraitFunctionality === null) {
$hasTraitFunctionality = function_exists('trait_exists');
}
$className = ltrim($className, '\\');
if (isset(self::$classMap[$className])) {
@ -370,7 +375,8 @@ class YiiBase
include($classFile);
if (class_exists($className, false) || interface_exists($className, false)) {
if (class_exists($className, false) || interface_exists($className, false) ||
($hasTraitFunctionality === true && trait_exists($className, false))) {
return true;
} else {
throw new UnknownClassException("Unable to find '$className' in file: $classFile");

Loading…
Cancel
Save