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

WP/EnqueuedResources: various tweaks #2176

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 21, 2022

WP/EnqueuedResources: add tests with PHP 7.3+ flexible heredoc/nowdocs

.. to safeguard these are handled correctly.

Note: these are in a separate file for maintainability as any code which would be placed after the flexible heredoc/nowdoc would not be tokenized correctly on PHP < 7.3, making the tests maintainance error prone if the tests were in the same file.

WP/EnqueuedResources: minor code performance tweak

Always retrieve the stack pointer to the last token of a potentially multi-line text string and skip to the end after analyzing the content.

While the TextStrings::getEndOfCompleteTextString() and the TextStrings::getCompleteTextString() have some overlap, the results of the overlapping code is cached, so this should barely affect performance, while skipping to the end of the text string will greatly improve performance for files containing long multi-line text strings.

WP/EnqueuedResources: minor message tweak for clarity

.. to safeguard these are handled correctly.

Note: these are in a separate file for maintainability as any code which would be placed _after_ the flexible heredoc/nowdoc would not be tokenized correctly on PHP < 7.3, making the tests maintainer error prone if the tests were in the same file.
Always retrieve the stack pointer to the last token of a potentially multi-line text string and skip to the end after analyzing the content.

While the `TextStrings::getEndOfCompleteTextString()` and the `TextStrings::getCompleteTextString()` have some overlap, the results of the overlapping code is cached, so this should barely affect performance, while skipping to the end of the text string will greatly improve performance for files containing long multi-line text strings.
Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

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

@GaryJones GaryJones merged commit 459f21a into develop Dec 22, 2022
@GaryJones GaryJones deleted the feature/enqueuedresources-phpcsutils-and-modern-php branch December 22, 2022 10:02
@jrfnl jrfnl mentioned this pull request Jan 7, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants