Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3863,7 +3863,7 @@ public function add_dynamic_settings( $setting_ids ) {
* @since 3.4.0
*
* @param string $id Customize Setting ID.
* @return WP_Customize_Setting|void The setting, if set.
* @return WP_Customize_Setting|null The setting, if set.
*/
public function get_setting( $id ) {
if ( isset( $this->settings[ $id ] ) ) {
Expand Down Expand Up @@ -3915,7 +3915,7 @@ public function add_panel( $id, $args = array() ) {
* @since 4.0.0
*
* @param string $id Panel ID to get.
* @return WP_Customize_Panel|void Requested panel instance, if set.
* @return WP_Customize_Panel|null Requested panel instance, if set.
*/
public function get_panel( $id ) {
if ( isset( $this->panels[ $id ] ) ) {
Expand Down Expand Up @@ -4011,7 +4011,7 @@ public function add_section( $id, $args = array() ) {
* @since 3.4.0
*
* @param string $id Section ID.
* @return WP_Customize_Section|void The section, if set.
* @return WP_Customize_Section|null The section, if set.
*/
public function get_section( $id ) {
if ( isset( $this->sections[ $id ] ) ) {
Expand Down Expand Up @@ -4090,7 +4090,7 @@ public function add_control( $id, $args = array() ) {
* @since 3.4.0
*
* @param string $id ID of the control.
* @return WP_Customize_Control|void The control object, if set.
* @return WP_Customize_Control|null The control object, if set.
*/
public function get_control( $id ) {
if ( isset( $this->controls[ $id ] ) ) {
Expand Down
8 changes: 4 additions & 4 deletions src/wp-includes/class-wp-customize-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,15 @@ final public function check_capabilities() {
* @param array $root
* @param array $keys
* @param bool $create Default false.
* @return array|void Keys are 'root', 'node', and 'key'.
* @return array|null Keys are 'root', 'node', and 'key'.
*/
final protected function multidimensional( &$root, $keys, $create = false ) {
if ( $create && empty( $root ) ) {
$root = array();
}

if ( ! isset( $root ) || empty( $keys ) ) {
return;
return null;
}

$last = array_pop( $keys );
Expand All @@ -876,7 +876,7 @@ final protected function multidimensional( &$root, $keys, $create = false ) {
}

if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) {
return;
return null;
}

$node = &$node[ $key ];
Expand All @@ -893,7 +893,7 @@ final protected function multidimensional( &$root, $keys, $create = false ) {
}

if ( ! isset( $node[ $last ] ) ) {
return;
return null;
}

return array(
Expand Down
12 changes: 6 additions & 6 deletions src/wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function is_widget_selective_refreshable( $id_base ) {
* @since 4.2.0
*
* @param string $setting_id Setting ID.
* @return string|void Setting type.
* @return string|null Setting type.
*/
protected function get_setting_type( $setting_id ) {
static $cache = array();
Expand Down Expand Up @@ -1454,7 +1454,7 @@ protected function get_instance_hash_key( $serialized_instance ) {
*
* @param array $value Widget instance to sanitize.
* @param string $id_base Optional. Base of the ID of the widget being sanitized. Default null.
* @return array|void Sanitized widget instance.
* @return array|null Sanitized widget instance.
*/
public function sanitize_widget_instance( $value, $id_base = null ) {
global $wp_widget_factory;
Expand Down Expand Up @@ -1483,21 +1483,21 @@ public function sanitize_widget_instance( $value, $id_base = null ) {
empty( $value['instance_hash_key'] ) ||
empty( $value['encoded_serialized_instance'] )
) {
return;
return null;
}

$decoded = base64_decode( $value['encoded_serialized_instance'], true );
if ( false === $decoded ) {
return;
return null;
}

if ( ! hash_equals( $this->get_instance_hash_key( $decoded ), $value['instance_hash_key'] ) ) {
return;
return null;
}

$instance = unserialize( $decoded );
if ( false === $instance ) {
return;
return null;
}

return $instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function print_header_image_template() {
*
* @since 3.9.0
*
* @return string|void
* @return string|null
*/
public function get_current_image_src() {
Copy link
Member

Choose a reason for hiding this comment

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

If $this->get_url didn't set then function didn;t return anything do we needs to return null after if statement?

Copy link

Choose a reason for hiding this comment

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

PHP's void type can not be part of a union type so it can either be only void or string|null etc.

Copy link
Author

Choose a reason for hiding this comment

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

as @xateman said, we considered adding an return null; on those functions, but adding that would add clutter and barely any to no value. It might be considerable, but I think thats out of scope for this issue.

$src = $this->value();
Expand Down
Loading