Skip to content

Commit ee837f5

Browse files
committed
Code Quality: Replace void with null in union return types in Customizer classes.
Developed in #11006 Follow-up to r61766, r61719, r61716. Props apermo, xate, mukesh27. See #64238. Fixes #64701. git-svn-id: https://develop.svn.wordpress.org/trunk@61767 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 50a3cc8 commit ee837f5

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/wp-includes/class-wp-customize-manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,7 @@ public function add_dynamic_settings( $setting_ids ) {
38633863
* @since 3.4.0
38643864
*
38653865
* @param string $id Customize Setting ID.
3866-
* @return WP_Customize_Setting|void The setting, if set.
3866+
* @return WP_Customize_Setting|null The setting, if set.
38673867
*/
38683868
public function get_setting( $id ) {
38693869
if ( isset( $this->settings[ $id ] ) ) {
@@ -3915,7 +3915,7 @@ public function add_panel( $id, $args = array() ) {
39153915
* @since 4.0.0
39163916
*
39173917
* @param string $id Panel ID to get.
3918-
* @return WP_Customize_Panel|void Requested panel instance, if set.
3918+
* @return WP_Customize_Panel|null Requested panel instance, if set.
39193919
*/
39203920
public function get_panel( $id ) {
39213921
if ( isset( $this->panels[ $id ] ) ) {
@@ -4011,7 +4011,7 @@ public function add_section( $id, $args = array() ) {
40114011
* @since 3.4.0
40124012
*
40134013
* @param string $id Section ID.
4014-
* @return WP_Customize_Section|void The section, if set.
4014+
* @return WP_Customize_Section|null The section, if set.
40154015
*/
40164016
public function get_section( $id ) {
40174017
if ( isset( $this->sections[ $id ] ) ) {
@@ -4090,7 +4090,7 @@ public function add_control( $id, $args = array() ) {
40904090
* @since 3.4.0
40914091
*
40924092
* @param string $id ID of the control.
4093-
* @return WP_Customize_Control|void The control object, if set.
4093+
* @return WP_Customize_Control|null The control object, if set.
40944094
*/
40954095
public function get_control( $id ) {
40964096
if ( isset( $this->controls[ $id ] ) ) {

src/wp-includes/class-wp-customize-setting.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,15 +856,15 @@ final public function check_capabilities() {
856856
* @param array $root
857857
* @param array $keys
858858
* @param bool $create Default false.
859-
* @return array|void Keys are 'root', 'node', and 'key'.
859+
* @return array|null Keys are 'root', 'node', and 'key'.
860860
*/
861861
final protected function multidimensional( &$root, $keys, $create = false ) {
862862
if ( $create && empty( $root ) ) {
863863
$root = array();
864864
}
865865

866866
if ( ! isset( $root ) || empty( $keys ) ) {
867-
return;
867+
return null;
868868
}
869869

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

878878
if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) {
879-
return;
879+
return null;
880880
}
881881

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

895895
if ( ! isset( $node[ $last ] ) ) {
896-
return;
896+
return null;
897897
}
898898

899899
return array(

src/wp-includes/class-wp-customize-widgets.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function is_widget_selective_refreshable( $id_base ) {
176176
* @since 4.2.0
177177
*
178178
* @param string $setting_id Setting ID.
179-
* @return string|void Setting type.
179+
* @return string|null Setting type.
180180
*/
181181
protected function get_setting_type( $setting_id ) {
182182
static $cache = array();
@@ -1454,7 +1454,7 @@ protected function get_instance_hash_key( $serialized_instance ) {
14541454
*
14551455
* @param array $value Widget instance to sanitize.
14561456
* @param string $id_base Optional. Base of the ID of the widget being sanitized. Default null.
1457-
* @return array|void Sanitized widget instance.
1457+
* @return array|null Sanitized widget instance.
14581458
*/
14591459
public function sanitize_widget_instance( $value, $id_base = null ) {
14601460
global $wp_widget_factory;
@@ -1483,21 +1483,21 @@ public function sanitize_widget_instance( $value, $id_base = null ) {
14831483
empty( $value['instance_hash_key'] ) ||
14841484
empty( $value['encoded_serialized_instance'] )
14851485
) {
1486-
return;
1486+
return null;
14871487
}
14881488

14891489
$decoded = base64_decode( $value['encoded_serialized_instance'], true );
14901490
if ( false === $decoded ) {
1491-
return;
1491+
return null;
14921492
}
14931493

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

14981498
$instance = unserialize( $decoded );
14991499
if ( false === $instance ) {
1500-
return;
1500+
return null;
15011501
}
15021502

15031503
return $instance;

src/wp-includes/customize/class-wp-customize-header-image-control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function print_header_image_template() {
193193
*
194194
* @since 3.9.0
195195
*
196-
* @return string|void
196+
* @return string|null
197197
*/
198198
public function get_current_image_src() {
199199
$src = $this->value();

0 commit comments

Comments
 (0)