Make WordPress Core

Changeset 32535


Ignore:
Timestamp:
05/21/2015 10:04:29 PM (11 years ago)
Author:
wonderboymusic
Message:

In class-wp-customize-*, clarify/add some @param/@return blocks. Disambiguate some functions that are trying to return the void response of another function they call internally.

See #32444.

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

Legend:

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

    r32382 r32535  
    216216         * @access public
    217217         *
    218          * @return bool Always true.
     218         * @return true Always true.
    219219         */
    220220        public function active_callback() {
    … …  
    680680         *
    681681         * @param WP_Customize_Manager $manager {@see WP_Customize_Manager} instance.
     682         * @param string $id
     683         * @param array $args
    682684         */
    683685        public function __construct( $manager, $id, $args = array() ) {
    … …  
    11241126        }
    11251127
     1128        /**
     1129         * @return string|null
     1130         */
    11261131        public function get_current_image_src() {
    11271132                $src = $this->value();
    … …  
    11301135                        return $src;
    11311136                }
    1132                 return null;
    11331137        }
    11341138
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r32265 r32535  
    648648         *
    649649         * @since 3.4.0
     650         *
     651         * @return mixed
    650652         */
    651653        public function remove_preview_signature( $return = null ) {
    … …  
    842844         * @since 4.2.0
    843845         *
    844          * @param string $setting_ids The setting IDs to add.
     846         * @param array $setting_ids The setting IDs to add.
    845847         * @return WP_Customize_Setting The settings added.
    846848         */
    … …  
    898900         *
    899901         * @param string $id Customize Setting ID.
    900          * @return WP_Customize_Setting
     902         * @return WP_Customize_Setting|null The setting, if set.
    901903         */
    902904        public function get_setting( $id ) {
    … …  
    943945         *
    944946         * @param string $id Panel ID to get.
    945          * @return WP_Customize_Panel Requested panel instance.
     947         * @return WP_Customize_Panel|null Requested panel instance, if set.
    946948         */
    947949        public function get_panel( $id ) {
    … …  
    986988         *
    987989         * @param string $id Section ID.
    988          * @return WP_Customize_Section
     990         * @return WP_Customize_Section|null The section, if set.
    989991         */
    990992        public function get_section( $id ) {
    … …  
    10281030         *
    10291031         * @param string $id ID of the control.
    1030          * @return WP_Customize_Control $control The control object.
     1032         * @return WP_Customize_Control|null The control object, if set.
    10311033         */
    10321034        public function get_control( $id ) {
    … …  
    15141516         *
    15151517         * @param string $color
    1516          * @return string
     1518         * @return mixed
    15171519         */
    15181520        public function _sanitize_header_textcolor( $color ) {
    … …  
    15461548        if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
    15471549                return $color;
    1548 
    1549         return null;
    15501550}
    15511551
  • trunk/src/wp-includes/class-wp-customize-section.php

    r32127 r32535  
    208208         * @access public
    209209         *
    210          * @return bool Always true.
     210         * @return true Always true.
    211211         */
    212212        public function active_callback() {
  • trunk/src/wp-includes/class-wp-customize-setting.php

    r32034 r32535  
    134134        public function is_current_blog_previewed() {
    135135                if ( ! isset( $this->_previewed_blog_id ) ) {
    136                         return null;
     136                        return;
    137137                }
    138138                return ( get_current_blog_id() === $this->_previewed_blog_id );
    … …  
    276276         * @since 3.4.0
    277277         *
    278          * @param mixed $value The value to sanitize.
    279          * @return mixed Null if an input isn't valid, otherwise the sanitized value.
     278         * @param string|array $value The value to sanitize.
     279         * @return string|array|null Null if an input isn't valid, otherwise the sanitized value.
    280280         */
    281281        public function sanitize( $value ) {
    … …  
    332332         *
    333333         * @param mixed $value The value to update.
    334          * @return mixed The result of saving the value.
    335334         */
    336335        protected function _update_theme_mod( $value ) {
    337336                // Handle non-array theme mod.
    338                 if ( empty( $this->id_data[ 'keys' ] ) )
    339                         return set_theme_mod( $this->id_data[ 'base' ], $value );
    340 
     337                if ( empty( $this->id_data[ 'keys' ] ) ) {
     338                        set_theme_mod( $this->id_data[ 'base' ], $value );
     339                        return;
     340                }
    341341                // Handle array-based theme mod.
    342342                $mods = get_theme_mod( $this->id_data[ 'base' ] );
    343343                $mods = $this->multidimensional_replace( $mods, $this->id_data[ 'keys' ], $value );
    344                 if ( isset( $mods ) )
    345                         return set_theme_mod( $this->id_data[ 'base' ], $mods );
     344                if ( isset( $mods ) ) {
     345                        set_theme_mod( $this->id_data[ 'base' ], $mods );
     346                }
    346347        }
    347348
    … …  
    352353         *
    353354         * @param mixed $value The value to update.
    354          * @return bool|null The result of saving the value.
     355         * @return bool The result of saving the value.
    355356         */
    356357        protected function _update_option( $value ) {
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r32243 r32535  
    123123                        }
    124124                }
    125                 return null;
    126125        }
    127126
    … …  
    237236         *
    238237         * @param array $old_sidebars_widgets
     238         * @return array
    239239         */
    240240        public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) {
    … …  
    254254         *
    255255         * @param array $sidebars_widgets
     256         * @return array
    256257         */
    257258        public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
    … …  
    919920         *
    920921         * @param array $sidebars_widgets List of widgets for the current sidebar.
     922         * @return array
    921923         */
    922924        public function preview_sidebars_widgets( $sidebars_widgets ) {
    … …  
    10411043         * @param bool   $is_active  Whether the sidebar is active.
    10421044         * @param string $sidebar_id Sidebar ID.
     1045         * @return bool
    10431046         */
    10441047        public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
    … …  
    10661069         * @param bool   $has_widgets Whether the current sidebar has widgets.
    10671070         * @param string $sidebar_id  Sidebar ID.
     1071         * @return bool
    10681072         */
    10691073        public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
    … …  
    11061110         *
    11071111         * @param array $value Widget instance to sanitize.
    1108          * @return array Sanitized widget instance.
     1112         * @return array|null Sanitized widget instance.
    11091113         */
    11101114        public function sanitize_widget_instance( $value ) {
    … …  
    11171121                        || empty( $value['encoded_serialized_instance'] ) )
    11181122                {
    1119                         return null;
     1123                        return;
    11201124                }
    11211125
    11221126                $decoded = base64_decode( $value['encoded_serialized_instance'], true );
    11231127                if ( false === $decoded ) {
    1124                         return null;
     1128                        return;
    11251129                }
    11261130
    11271131                if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
    1128                         return null;
     1132                        return;
    11291133                }
    11301134
    11311135                $instance = unserialize( $decoded );
    11321136                if ( false === $instance ) {
    1133                         return null;
     1137                        return;
    11341138                }
    11351139
Note: See TracChangeset for help on using the changeset viewer.