Repository navigation
Replace the middleware Stack with Next - #216
Merged
Merged
Conversation
Middlewares had to ask the stack for the next middleware and pass the stack on again with every call. They now receive Next, which calls the rest of the stack directly: $next->hydrate($metadata, $data, $context). Next restores its position after each call, so a middleware can call the rest of the stack more than once, which skipped middlewares with Stack.
|
Hello 👋 here is the most recent benchmark result:
This comment gets update everytime a new commit comes in! |
# Conflicts: # docs/UPGRADE-3.0.md # tests/Unit/StackHydratorTest.php
DanielBadura
approved these changes
Oct 6, 2026
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.
Middlewares get a
Nextinstead of theStack. Instead of$stack->next()->hydrate($metadata, $data, $context, $stack)a middleware now calls$next->hydrate($metadata, $data, $context), so the stack no longer has to be passed along by hand.Nextkeeps the position likeStackdid, but restores it after every call. A middleware which calls the rest of the stack twice (or retries after an exception) now runs the following middlewares again, withStackthe second call skipped one.This is a BC break for 3.0, every middleware signature changes from
Stack $stacktoNext $next. The migration is described indocs/UPGRADE-3.0.md. That file is also added in #215, so whichever is merged second needs a small merge of the two sections.The
TransformMiddlewarestill ends the stack. Once the transformer from #214 lands in 3.0,Nextcan call the transformer itself at the end and theTransformMiddlewaregoes away.