Avoid tokenizing files for nothing
parent
f1320bf7a1
commit
383c3f0153
|
@ -89,6 +89,9 @@ class ClassMapGenerator
|
||||||
{
|
{
|
||||||
$contents = file_get_contents($path);
|
$contents = file_get_contents($path);
|
||||||
try {
|
try {
|
||||||
|
if (!preg_match('{\b(?:class|interface|trait)\b}i', $contents)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$tokens = token_get_all($contents);
|
$tokens = token_get_all($contents);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e);
|
throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e);
|
||||||
|
|
Loading…
Reference in New Issue