Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat global constant declared using const keyword as global and not class constant #57

Merged
merged 1 commit into from Nov 22, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions classes/phpDoctor.php
Expand Up @@ -807,9 +807,18 @@ function &parse()
break;

case T_STRING:
$constOutsideOfClass = (isset($tokens[$key - 2][1]) && $tokens[$key - 2][1] == 'const');

// read global constant
if ($token[1] == 'define') {// && $tokens[$key + 2][0] == T_CONSTANT_ENCAPSED_STRING) {
$const =& new fieldDoc($this->_getNext($tokens, $key, T_CONSTANT_ENCAPSED_STRING), $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create constant object
if ($token[1] == 'define' || $constOutsideOfClass) {// && $tokens[$key + 2][0] == T_CONSTANT_ENCAPSED_STRING) {
if (!$constOutsideOfClass) {
// Current token is define() function.
$constantName = $this->_getNext($tokens, $key, T_CONSTANT_ENCAPSED_STRING);
} else {
// Current token is constant's name.
$constantName = $token[1];
}
$const =& new fieldDoc($constantName, $ce, $rootDoc, $filename, $lineNumber, $this->sourcePath()); // create constant object
$this->verbose('Found '.get_class($const).': global constant '.$const->name());
$const->set('final', TRUE); // is constant
$value = '';
Expand Down