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

Commit

Permalink
Added an error message in the DebugClassLoader when using / instead o…
Browse files Browse the repository at this point in the history
…f \.
  • Loading branch information
stof authored and fabpot committed Jan 19, 2013
1 parent 585c3e0 commit 3f23850
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DebugClassLoader.php
Expand Up @@ -82,6 +82,10 @@ public function loadClass($class)
require $file;

if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
if (false !== strpos($class, '/')) {
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".'));
}

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 3f23850

Please sign in to comment.