Skip to content

Fix global variables wrongly parsed #233

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/class-file-reflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function enterNode( \PHPParser_Node $node ) {
// we don't ignore them, we'll end up picking up docblocks that are already
// associated with a named element, and so aren't really from a non-
// documentable element after all.
if ( ! $this->isNodeDocumentable( $node ) && 'Name' !== $node->getType() && ( $docblock = $node->getDocComment() ) ) {
if ( ! $this->isNodeDocumentable( $node ) && ! in_array( $node->getType(), array( 'Name', 'Stmt_Global' ), true ) && ( $docblock = $node->getDocComment() ) ) {
$this->last_doc = $docblock;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function parse_files( $files, $root ) {

foreach ( $file->getIncludes() as $include ) {
$out['includes'][] = array(
'name' => $include->getName(),
'name' => property_exists( $include->getNode()->expr, 'value' ) ? $include->getName() : '',
'line' => $include->getLineNumber(),
'type' => $include->getType(),
);
Expand Down