-
Notifications
You must be signed in to change notification settings - Fork 108
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
Introduce get_cursor_move_count() to use instead of get_seek_count() and get_next_token_count() #1478
Conversation
…and get_next_token_count()
…eady incremented in next_token()
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
/** | ||
* Gets the number of times next_token() was called. | ||
* | ||
* @since 0.4.1 | ||
* @see self::next_token() | ||
* @deprecated Use {@see self::get_cursor_move_count()} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we deprecating this so dependent plugins don't break? If we don't explicitly call from outside the plugin, couldn't we just remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could just remove it. I'm happy to do do if you think that's best. It's extremely unlikely anyone is using these deprecated methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in f4d0f8c
Co-authored-by: adamsilverstein <[email protected]>
When explaining Optimization Detective's iteration over the tags in the document in #1476 (comment), I realized that the naming of the
OD_HTML_Tag_Processor::get_next_token_count()
method is poor. It's supposed to count the number of times thatnext_token()
was called, but it looks like it gives you a count of the remaining tokens in the document. Also, in addition to this method there isget_seek_count()
which returns the underlying protected$seek_count
variable. We don't really need these two methods and can instead have a singleget_cursor_move_count()
that keeps track of the number of times thatnext_token()
was called (which is what is called both byseek()
andnext_tag()
).