-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Restore void on the dual-mode $display functions with conditional return types
#13359
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
Closed
westonruter
wants to merge
11
commits into
WordPress:trunk
from
westonruter:fix/display-conditional-void-returns
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cc7f684
Restore `void` on the dual-mode `$display` template tags
westonruter 92857eb
Extend the conditional `void` return types to the rest of the `$displ…
westonruter 9ea267e
Correct the inverted `$display` return docs on three `print_*()` methods
westonruter e60fdaf
Apply the conditional `void` return types to the `echo` argument temp…
westonruter f0e1c8c
Spell the retrieval branch `void` where the bail is a bare `return;`
westonruter 6adf275
Use `null` in the delegating title wrappers, which return a value rat…
westonruter 88f78ee
Give every conditional one `void` branch and one nullable branch
westonruter 41f3534
Add the conditional return type to `trackback_url()`
westonruter 63daacd
Add the conditional return type to `twentytwenty_site_description()`
westonruter aff028d
Account for the legacy boolean argument in `get_search_form()`
westonruter 179a78c
Note the empty string these three tags can return
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,8 +296,9 @@ public function add_inline_style( $handle, $code ) { | |
| * @param string $handle The style's registered handle. | ||
| * @param bool $display Optional. Whether to print the inline style | ||
| * instead of just returning it. Default true. | ||
| * @return string|bool False if no data exists, inline styles if `$display` is true, | ||
| * @return string|bool False if no data exists, inline styles if `$display` is false, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems massive, that is the complete opposite of before, was this wrong all the way?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes 😬 |
||
| * true otherwise. | ||
| * @phpstan-return ( $display is true ? bool : string|false ) | ||
| */ | ||
| public function print_inline_style( $handle, $display = true ) { | ||
| $output = $this->get_data( $handle, 'after' ); | ||
|
|
||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Same as below, this change seems massive, I can't believe that this slipped through and was wrong twice all the time.
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.
Double checked, these were wrong all the way since their introduction in WP4.5 nearly 10 years ago.