[11.x] Fix for breaking change in #53543 when ::withoutWrapping() is called after instance creation #53685
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.
Fixes breaking change introduced in #53543
Comment finding the breaking change: #53543 (comment)
See failing test which is added to test the code below now is without a wrapper:
This PR adds a check to determine if an explicit wrapper has been set on the instance, if not, use the logic from before #53543, this allows for static wrapper changes after the instance is created to have impact.
12.x consideration
It's worth considering making an intended breaking change in 12.x to no longer let static updates change the wrapper after instantiation, but this PR focuses on removing the breaking change I introduced with #53543
wrapper
property considerationEdit: this fix does introduce the side effect that manually setting
$instance->wrapper = 'posts'
will now have no effect, since that doesn't set thewrapperSet
flag. Maybe thewrapper
property should be protected/private with a getter (or async visibility in the future 👀)