WordPress.org

Make WordPress Core

Changeset 31136


Ignore:
Timestamp:
01/10/2015 11:27:00 PM (5 years ago)
Author:
wonderboymusic
Message:

In WP_MatchesMapRegex:

  • Exactly one method was made private in [28516], and is only used internally.
  • 2 properties were made private, but they just store variables passed to the constructor.
  • Instances of this class are never created in core. WP_MatchesMapRegex::apply() is called statically in WP->parse_request() and url_to_postid().

The chances that:
1) this class is used as an instance somewhere and
2) the properties that have always been marked @access private and begin with _ were used publicly

...is extremely low.

Remove the magic methods, I should not have added them.

While we're at it, use the PHP5-style __construct() instead of the class name.

See #30891.

File:
1 edited

Legend:

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

    r31090 r31136  
    663663
    664664    /**
    665      * Make private properties readable for backwards compatibility.
    666      *
    667      * @since 4.0.0
    668      * @access public
    669      *
    670      * @param string $name Property to get.
    671      * @return mixed Property.
    672      */
    673     public function __get( $name ) {
    674         return $this->$name;
    675     }
    676 
    677     /**
    678      * Make private properties settable for backwards compatibility.
    679      *
    680      * @since 4.0.0
    681      * @access public
    682      *
    683      * @param string $name  Property to set.
    684      * @param mixed  $value Property value.
    685      * @return mixed Newly-set property.
    686      */
    687     public function __set( $name, $value ) {
    688         return $this->$name = $value;
    689     }
    690 
    691     /**
    692      * Make private properties checkable for backwards compatibility.
    693      *
    694      * @since 4.0.0
    695      * @access public
    696      *
    697      * @param string $name Property to check if set.
    698      * @return bool Whether the property is set.
    699      */
    700     public function __isset( $name ) {
    701         return isset( $this->$name );
    702     }
    703 
    704     /**
    705      * Make private properties un-settable for backwards compatibility.
    706      *
    707      * @since 4.0.0
    708      * @access public
    709      *
    710      * @param string $name Property to unset.
    711      */
    712     public function __unset( $name ) {
    713         unset( $this->$name );
    714     }
    715 
    716     /**
    717      * Make private/protected methods readable for backwards compatibility.
    718      *
    719      * @since 4.0.0
    720      * @access public
    721      *
    722      * @param callable $name      Method to call.
    723      * @param array    $arguments Arguments to pass when calling.
    724      * @return mixed|bool Return value of the callback, false otherwise.
    725      */
    726     public function __call( $name, $arguments ) {
    727         return call_user_func_array( array( $this, $name ), $arguments );
    728     }
    729 
    730     /**
    731665     * constructor
    732666     *
     
    735669     * @return self
    736670     */
    737     public function WP_MatchesMapRegex($subject, $matches) {
     671    public function __construct($subject, $matches) {
    738672        $this->_subject = $subject;
    739673        $this->_matches = $matches;
Note: See TracChangeset for help on using the changeset viewer.