Skip to content

Commit

Permalink
Handle class constants named "namespace" correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 7, 2009
1 parent e16e4fa commit ac4c1a4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions PHPLOC/Analyser.php
Expand Up @@ -518,17 +518,21 @@ protected function countEloc($filename, $loc)
*/
protected function getNamespaceName(array $tokens, $i)
{
$namespace = $tokens[$i+2][1];

for ($j = $i+3; ; $j += 2) {
if (isset($tokens[$j]) && $tokens[$j][0] == T_NS_SEPARATOR) {
$namespace .= '\\' . $tokens[$j+1][1];
} else {
break;
if (isset($tokens[$i+2][1])) {
$namespace = $tokens[$i+2][1];

for ($j = $i+3; ; $j += 2) {
if (isset($tokens[$j]) && $tokens[$j][0] == T_NS_SEPARATOR) {
$namespace .= '\\' . $tokens[$j+1][1];
} else {
break;
}
}

return $namespace;
}

return $namespace;
return FALSE;
}

/**
Expand Down

0 comments on commit ac4c1a4

Please sign in to comment.