Refactor duotone class to allow instancing#49932
Closed
ajlende wants to merge 11 commits into
Closed
Conversation
added 7 commits
April 18, 2023 14:46
664558e to
c5df7ae
Compare
6111f89 to
f6a59ec
Compare
This was referenced Apr 19, 2023
Merged
f6a59ec to
6bd5cc9
Compare
|
Flaky tests detected in f6a59ec1104bc890476a239673f0bfab483eddb1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4748009529
|
c5df7ae to
498a2b0
Compare
Contributor
Author
|
The public functions are tied directly to the hooks that need to be called over the course of a single page render, so instancing doesn't really make sense. If we ever need instancing for another reason, we can make a new class with instancing. |
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.
What?
Part 5 in a set of duotone php refactoring to fix small issues in duotone rendering.
This part changes the architecture of the duotone class to allow for instancing.
Why?
This allows for more flexibility in the future if we may need multiple instances of the duotone rendering state.
This should also make things a little easier to test since we can just create a new instance rather than resetting the static properties between tests.
How?
private staticproperties to be instance properties$wp_duotone_supportglobal much like is done forWP_StylesandWP_Scripts.The first commit shows what it would look like as a singleton instead. I feel like I slightly prefer the global version, but if there's a compelling argument to use a singleton instead I can easily switch back.
Testing Instructions
Example content for TT3 block-out, canary, and pilgrimage variations