fix wrong line-numbers caused by removed comments

This commit is contained in:
Ralf Becker 2016-03-21 20:42:06 +00:00
parent 847abfb198
commit 0558781183

View File

@ -28,8 +28,11 @@ function check_namespace($file)
if (($content = file_get_contents($file)) === false) return false;
// remove commented lines
$lines = preg_replace('#(//.*$|/\\*.*\\*/)#msU', '', $content);
// replace commented lines with empty ones
$lines = preg_replace_callback('#(//.*$|/\\*.*\\*/)#msU', function($matches)
{
return str_repeat("\n", substr_count($matches[0], "\n"));
}, $content);
$namespace = '';
$use = array();