Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.