Make WordPress Core


Ignore:
Timestamp:
01/11/2015 12:12:47 AM (10 years ago)
Author:
wonderboymusic
Message:

WP_Ajax_Response has one property only, $responses. It was public until [28508], when it became private in name only. Is it worth 4 magic methods to pretend that this property is private? It is not.

Make it public and remove the magic methods.

See #30891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-ajax-response.php

    r31126 r31139  
    1212     * @since 2.1.0
    1313     * @var array
    14      * @access private
    1514     */
    16     private $responses = array();
     15    public $responses = array();
    1716
    1817    /**
     
    2726        if ( !empty($args) )
    2827            $this->add($args);
    29     }
    30 
    31     /**
    32      * Make private properties readable for backwards compatibility.
    33      *
    34      * @since 4.0.0
    35      * @access public
    36      *
    37      * @param string $name Property to get.
    38      * @return mixed Property.
    39      */
    40     public function __get( $name ) {
    41         return $this->$name;
    42     }
    43 
    44     /**
    45      * Make private properties settable for backwards compatibility.
    46      *
    47      * @since 4.0.0
    48      * @access public
    49      *
    50      * @param string $name  Property to set.
    51      * @param mixed  $value Property value.
    52      * @return mixed Newly-set property.
    53      */
    54     public function __set( $name, $value ) {
    55         return $this->$name = $value;
    56     }
    57 
    58     /**
    59      * Make private properties checkable for backwards compatibility.
    60      *
    61      * @since 4.0.0
    62      * @access public
    63      *
    64      * @param string $name Property to check if set.
    65      * @return bool Whether the property is set.
    66      */
    67     public function __isset( $name ) {
    68         return isset( $this->$name );
    69     }
    70 
    71     /**
    72      * Make private properties un-settable for backwards compatibility.
    73      *
    74      * @since 4.0.0
    75      * @access public
    76      *
    77      * @param string $name Property to unset.
    78      */
    79     public function __unset( $name ) {
    80         unset( $this->$name );
    8128    }
    8229
Note: See TracChangeset for help on using the changeset viewer.