Make WordPress Core

Changeset 61767


Ignore:
Timestamp:
02/27/2026 11:17:12 PM (9 months ago)
Author:
westonruter
Message:

Code Quality: Replace void with null in union return types in Customizer classes.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/11006

Follow-up to r61766, r61719, r61716.

Props apermo, xate, mukesh27.
See #64238.
Fixes #64701.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r61403 r61767  
    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 ) {
    … …  
    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 ) {
    … …  
    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 ) {
    … …  
    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 ) {
  • trunk/src/wp-includes/class-wp-customize-setting.php

    r61670 r61767  
    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 ) {
    … …  
    865865
    866866                if ( ! isset( $root ) || empty( $keys ) ) {
    867                         return;
     867                        return null;
    868868                }
    869869
    … …  
    877877
    878878                        if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) {
    879                                 return;
     879                                return null;
    880880                        }
    881881
    … …  
    894894
    895895                if ( ! isset( $node[ $last ] ) ) {
    896                         return;
     896                        return null;
    897897                }
    898898
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r61433 r61767  
    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 ) {
    … …  
    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 ) {
    … …  
    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
  • trunk/src/wp-includes/customize/class-wp-customize-header-image-control.php

    r61271 r61767  
    194194         * @since 3.9.0
    195195         *
    196          * @return string|void
     196         * @return string|null
    197197         */
    198198        public function get_current_image_src() {
Note: See TracChangeset for help on using the changeset viewer.