diff --git a/src/core/Loader.php b/src/core/Loader.php index 491af65..167b6fd 100644 --- a/src/core/Loader.php +++ b/src/core/Loader.php @@ -15,15 +15,9 @@ use Exception; */ class Loader { - /** - * Registered classes. - * @var array, ?callable(object): void}> - */ + /** @var array, ?callable(object): void}> */ protected array $classes = []; - /** If this is disabled, classes can load with underscores */ - protected static bool $v2ClassLoading = true; - /** @var array Class instances */ protected array $instances = []; @@ -164,7 +158,7 @@ class Loader */ public static function loadClass(string $class): void { - $replace_chars = self::$v2ClassLoading ? ['\\', '_'] : ['\\']; + $replace_chars = ['\\']; $classFile = str_replace($replace_chars, '/', $class) . '.php'; foreach (self::$dirs as $dir) { @@ -194,14 +188,4 @@ class Loader } } } - - - /** - * Sets the value for V2 class loading. - * @param bool $value The value to set for V2 class loading. - */ - public static function setV2ClassLoading(bool $value): void - { - self::$v2ClassLoading = $value; - } } diff --git a/tests/LoaderTest.php b/tests/LoaderTest.php index de37efa..2ab19b3 100644 --- a/tests/LoaderTest.php +++ b/tests/LoaderTest.php @@ -146,23 +146,12 @@ class LoaderTest extends TestCase return self::$dirs; } }; + $loader->addDirectory([__DIR__ . '/classes']); + self::assertEquals([ dirname(__DIR__), __DIR__ . '/classes' ], $loader->getDirectories()); } - - public function testV2ClassLoading(): void - { - $loader = new class extends Loader { - public static function getV2ClassLoading() - { - return self::$v2ClassLoading; - } - }; - $this->assertTrue($loader::getV2ClassLoading()); - $loader::setV2ClassLoading(false); - $this->assertFalse($loader::getV2ClassLoading()); - } }