Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix doc comment for get_metadata_boolean
  • Loading branch information
Alex Lende committed Feb 17, 2022
commit 203c0640c8a1bcf8ea6f0b6dc846d3271d61ca99
1 change: 1 addition & 0 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ public function get_svg_filters( $origins ) {
*
* @param array $data The data to inspect.
* @param bool|array $path Boolean or path to a boolean.
* @param bool $default Default value if the referenced path is missing.
* @return boolean
*/
private static function get_metadata_boolean( $data, $path, $default = false ) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use old logic from should_override_preset instead of introducing a new method and removing the old one?

This method won't be private after WordPress#2322.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible. I would strongly advise against using the old one.

The old method is confusing because it returns either the boolean or the inverse of the boolean when a path is passed. Making the return consistent—the boolean or the boolean at the end of a path—is much easier to understand. And it doesn't require checking if the path argument is an array at both the call site and the method.

Expand Down