diff --git a/src/RobotLoader/RobotLoader.php b/src/RobotLoader/RobotLoader.php index 9fa4257..ef6d5dc 100644 --- a/src/RobotLoader/RobotLoader.php +++ b/src/RobotLoader/RobotLoader.php @@ -355,10 +355,6 @@ private function scanPhp(string $file): array $expected = $token->id; $name = ''; continue 2; - - case T_CURLY_OPEN: - case T_DOLLAR_OPEN_CURLY_BRACES: - $level++; } if ($expected) { diff --git a/tests/Loaders/RobotLoader.phpt b/tests/Loaders/RobotLoader.phpt index 1139830..a23e99a 100644 --- a/tests/Loaders/RobotLoader.phpt +++ b/tests/Loaders/RobotLoader.phpt @@ -20,6 +20,7 @@ $loader->addDirectory(__DIR__ . '/files/'); // purposely doubled $loader->addDirectory(__DIR__ . '/file/interface.php'); // as file $loader->addDirectory(__DIR__ . '/file/class.const.php'); $loader->addDirectory(__DIR__ . '/file/trait.php'); +$loader->addDirectory(__DIR__ . '/file/bug-28.php'); $loader->excludeDirectory(__DIR__ . '/files/exclude'); $loader->excludeDirectory(__DIR__ . '/files/exclude2/excluded.php'); $loader->register(); @@ -27,6 +28,7 @@ $loader->register(); Assert::false(class_exists('ConditionalClass')); // files/conditional.class.php Assert::true(interface_exists('TestInterface')); // file/interface.php Assert::true(trait_exists('TestTrait')); // file/trait.php +Assert::true(class_exists('Bug28')); // file/bug-28.php Assert::true(class_exists('TestClass')); // files/namespaces1.php Assert::true(class_exists('MySpace1\TestClass1')); // files/namespaces1.php diff --git a/tests/Loaders/file/bug-28.php b/tests/Loaders/file/bug-28.php new file mode 100644 index 0000000..ec25211 --- /dev/null +++ b/tests/Loaders/file/bug-28.php @@ -0,0 +1,13 @@ +