diff --git a/doc/check_namespace.php b/doc/check_namespace.php index 2af966f286..17f14f0f48 100755 --- a/doc/check_namespace.php +++ b/doc/check_namespace.php @@ -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();