-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Move theme.json support check to class #28788
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍
LGTM
* | ||
* @var boolean | ||
*/ | ||
private static $theme_has_support = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, is there a difference if we skip the = null
part?
Usually I'd just write it like private static $theme_has_support;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I don't think it'd matter in this particular case.
I understand it's a good practice to always initialize them and be explicit so you don't have to think about how the engine would do it and avoid weird cases:
- there's an uninitialized variable, you think the engine is going to initialize it to null
- with that expectation, in certain places of the code you use the
isset
check - however, the engine decides to initialize it to an empty string because of some type checking it has done
- result: weird bug!
I don't know how much of this holds true for modern engines in any language VS being a no longer necessary convention people still do.
Size Change: 0 B Total Size: 1.37 MB ℹ️ View Unchanged
|
This PR continues the maturation of
WP_Theme_JSON_Resolver
. It ports an existing method that was declared inglobal-styles.php
into this class, following up on some recent improvements #28786 #28700Changes:
WP_Theme_JSON_Resolver::theme_has_support()
.