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

Fix global variables wrongly parsed #233

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Lucisu
Copy link

@Lucisu Lucisu commented Oct 4, 2022

Fixes issue #230 by checking if the variable is global before assigning it to the $this->last_doc.

@kkmuffme
Copy link

kkmuffme commented Apr 3, 2023

We also need to reset the last doc to null, when we declare a function/method, as otherwise it will apply the tags in cases like:

/**
 * @deprecated some text 
 */
add_filter( 'foo', 'bar' );

/**
 * @deprecated other text
 */
function hello() {
	return apply_filters( 'my_filter', '' );
}

"my_filter" will suddenly have the @deprecated some text comment added, even though it's completely irrelevant

Just add $this->last_doc = null; before this line

array_push( $this->location, $node );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants