Skip to content

Conversation

@westonruter
Copy link
Member

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 that next_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 is get_seek_count() which returns the underlying protected $seek_count variable. We don't really need these two methods and can instead have a single get_cursor_move_count() that keeps track of the number of times that next_token() was called (which is what is called both by seek() and next_tag()).

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels Aug 16, 2024
@github-actions
Copy link

github-actions bot commented Aug 16, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

*
* @since 0.4.1
* @see self::next_token()
* @deprecated Use {@see self::get_cursor_move_count()} instead.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in f4d0f8c

@westonruter westonruter merged commit e414842 into trunk Aug 21, 2024
@westonruter westonruter deleted the improve/cursor-move-count branch August 21, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature

Projects

Status: Done 😃

Development

Successfully merging this pull request may close these issues.

4 participants