diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index c8bf43099..2faef3bc6 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -89,6 +89,9 @@ class ClassMapGenerator { $contents = file_get_contents($path); try { + if (!preg_match('{\b(?:class|interface|trait)\b}i', $contents)) { + return array(); + } $tokens = token_get_all($contents); } catch (\Exception $e) { throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e);