Added class not found exception to SplClassLoader

This commit is contained in:
Shoghi Cervantes
2014-04-03 14:01:44 +02:00
parent 5da68059ee
commit ee6dc989ce

View File

@ -130,7 +130,11 @@ class SplClassLoader implements SplAutoloader{
*/ */
public function load($resourceName){ public function load($resourceName){
$resourceAbsolutePath = $this->getResourceAbsolutePath($resourceName); $resourceAbsolutePath = $this->getResourceAbsolutePath($resourceName);
if($resourceAbsolutePath == ""){
throw new \RuntimeException(
sprintf('Autoloader couldn\'t find a file to include for %s', $resourceName)
);
}
switch(true){ switch(true){
case ($this->mode & self::MODE_SILENT): case ($this->mode & self::MODE_SILENT):
if($resourceAbsolutePath !== false){ if($resourceAbsolutePath !== false){
@ -140,13 +144,7 @@ class SplClassLoader implements SplAutoloader{
case ($this->mode & self::MODE_NORMAL): case ($this->mode & self::MODE_NORMAL):
default: default:
if(!file_exists($resourceAbsolutePath)){ require $resourceAbsolutePath;
throw new \RuntimeException(
sprintf('Autoloader expected in file "%s" to exist.', $resourceAbsolutePath)
);
}else{
require $resourceAbsolutePath;
}
break; break;
} }