diff --git a/util/AutoloadBuilder.php b/util/AutoloadBuilder.php index 14e4d2c..8adfaf6 100644 --- a/util/AutoloadBuilder.php +++ b/util/AutoloadBuilder.php @@ -22,7 +22,7 @@ class AutoloadBuilder protected $handler; - protected $regex = '/(class|interface) ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/'; + protected $regex = '/\n(abstract |final )?(class|interface) ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/'; public function __construct($autoload, $dirs = array(), $exclude = array()) { @@ -34,7 +34,7 @@ class AutoloadBuilder public function build() { $array_string = "dirs as $dir) { $iterator = new RecursiveIteratorIterator( @@ -43,7 +43,9 @@ class AutoloadBuilder ); foreach ($iterator as $file) { - + /** + * @var SplFileInfo $file + */ if ($this->isExcluded($file->getRealPath())) { continue; } @@ -60,11 +62,11 @@ class AutoloadBuilder if (preg_match_all($this->regex, $content, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { - if (array_key_exists($match[2], $classes)) { + if (array_key_exists($match[3], $classes)) { continue; } - $array_string .= "'{$match[2]}'=>'" . $relative_path . "',\n"; - $classes[$match[2]] = $file->getRealPath(); + $array_string .= "'{$match[3]}'=>'" . $relative_path . "',\n"; + $classes[$match[3]] = $file->getRealPath(); } } }