Conversation
Contributor
Benchmark Results
Median of 10 attempts (* = outlier, excluded from result), 5000 iterations x 10 rounds, 49.87s total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scenario
A
@verbatimblock inside a Blaze component template:The problem
When wrapping a Blaze component, we need to restore
@phpblocks so we can hoistusestatements above the function definition. We used Laravel's store/restore raw blocks methods for this — but restoring raw blocks also restored the content inside@verbatimblocks. That content would then get parsed by Blade later on, defeating the purpose of@verbatim.The solution
We already have a pattern where we store raw blocks but preserve the original content including the wrapping
@verbatim/@endverbatimdirectives — that way when they're restored, Laravel sees the directives and ignores the content again. We just weren't applying this pattern in the Wrapper.Extracted a shared
storeRawBlockmethod onBladeServiceand added the verbatim/php regexes toLaravelRegexso bothstoreVerbatimBlocksandpreStoreUncompiledBlocksuse the same approach.