From 8d25d89d86e4d0533af13a1acfaa5005a489c550 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 24 Feb 2017 21:05:49 +0100 Subject: [PATCH] The class loader is also now strict in namespace check, so nice backtraces will be created. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/loader/class_ClassLoader.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index ed5b7825..95e26bb1 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -7,6 +7,7 @@ use CoreFramework\Configuration\FrameworkConfiguration; use CoreFramework\Object\BaseFrameworkSystem; // Import SPL stuff +use \InvalidArgumentException; use \RecursiveDirectoryIterator; use \RecursiveIteratorIterator; @@ -35,8 +36,8 @@ use \RecursiveIteratorIterator; * ---------------------------------- * 1.5 * - Namespace scheme Project\Package[\SubPackage...] is fully supported and - * throws an E_USER_WARNING if not present. The last part will be always the - * class' name. + * throws an InvalidArgumentException if not present. The last part will be + * always the class' name. * 1.4 * - Some comments improved, other minor improvements * 1.3 @@ -422,7 +423,7 @@ class ClassLoader { // At least 3 parts should be there if (count($classNameParts) < 3) { // Namespace scheme is: Project\Package[\SubPackage...] - trigger_error(sprintf('Class name "%s" is not conform to naming-convention: Project\Package[\SubPackage...]\SomeFooBar', $className), E_USER_WARNING); + throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Project\Package[\SubPackage...]\SomeFooBar', $className)); } // END - if // Get last element -- 2.39.5