X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=framework%2Floader%2Fclass_ClassLoader.php;h=9e0e4bacf06e35c18356a0df568735a3ed29861a;hb=498e6b065ce47804bff4e1073592a2cc8e28f8ef;hp=5035d3f83cce41ea94ec6edf90f4a824a67f15e6;hpb=868c877607670760eb36e63ebeb1a04237907be9;p=core.git diff --git a/framework/loader/class_ClassLoader.php b/framework/loader/class_ClassLoader.php index 5035d3f8..9e0e4bac 100644 --- a/framework/loader/class_ClassLoader.php +++ b/framework/loader/class_ClassLoader.php @@ -17,7 +17,7 @@ use \SplFileInfo; * * @author Roland Haeder * @version 1.5.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -62,12 +62,12 @@ class ClassLoader { /** * Array with all found classes */ - private $foundClasses = array(); + private $foundClasses = []; /** * List of loaded classes */ - private $loadedClasses = array(); + private $loadedClasses = []; /** * Suffix with extension for all class files @@ -83,7 +83,7 @@ class ClassLoader { * A list for directory names (no leading/trailing slashes!) which not be scanned by the path scanner * @see scanLocalPath */ - private $ignoreList = array(); + private $ignoreList = []; /** * Debug this class loader? (true = yes, false = no) @@ -134,7 +134,7 @@ class ClassLoader { * Registered paths where test classes can be found. These are all relative * to base_path . */ - private static $testPaths = array(); + private static $testPaths = []; /** * The protected constructor. Please use the factory method below, or use @@ -351,7 +351,7 @@ class ClassLoader { * @param $strictNamingConvention Whether to strictly check naming-convention * @return void */ - public static function enableStrictNamingConventionCheck ($strictNamingConvention = true) { + public static function enableStrictNamingConventionCheck (bool $strictNamingConvention = true) { self::$strictNamingConvention = $strictNamingConvention; } @@ -362,7 +362,7 @@ class ClassLoader { * @param $relativePath Relative path to test classes * @return void */ - public static function registerTestsPath ($relativePath) { + public static function registerTestsPath (string $relativePath) { // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: relativePath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $relativePath); @@ -379,7 +379,7 @@ class ClassLoader { * @param $className Name of the class to load * @return void */ - public static function autoLoad ($className) { + public static function autoLoad (string $className) { // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); @@ -413,7 +413,7 @@ class ClassLoader { * @param $ignoreList An optional list (array forced) of directory and file names which shall be ignored * @return void */ - public function scanClassPath ($basePath, array $ignoreList = array() ) { + public function scanClassPath (string $basePath, array $ignoreList = [] ) { // Is a list has been restored from cache, don't read it again if ($this->listCached === true) { // Abort here @@ -565,11 +565,9 @@ class ClassLoader { * @return void * @throws InvalidArgumentException If strict-checking is enabled and class name is not following naming-convention */ - private function loadClassFile ($className) { - // Trace message - //* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); - + private function loadClassFile (string $className) { // The class name should contain at least 2 back-slashes, so split at them + //* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); $classNameParts = explode("\\", $className); // At least 3 parts should be there