[buddypress-trac] [BuddyPress Trac] #7018: Properly declare all properties on classes

buddypress-trac noreply at wordpress.org
Fri Apr 15 05:40:01 UTC 2016


#7018: Properly declare all properties on classes
------------------------------+------------------------------
 Reporter:  tw2113            |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Component - Core  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |
------------------------------+------------------------------
Description changed by tw2113:

Old description:

> We have a number of classes available, whether internal or public for
> users, and that's wonderful. However, we have not always properly
> declared the properties that we set in the __construct() methods or
> elsewhere in the class. We should work to change that fact.
>
> Example from BP_Groups_Group:
>
> {{{
> /**
>  * ID of the group.
>  *
>  * @since 1.6.0
>  * @var int
>  */
> public $id;
> }}}
>
> {{{
> public function __construct( $id = null, $args = array() ) {
>         $this->args = wp_parse_args( $args, array(
>                 'populate_extras' => false,
>         ) );
>
>         if ( !empty( $id ) ) {
>                 $this->id = $id;
>                 $this->populate();
>         }
> }
> }}}

New description:

 We have a number of classes available, whether internal or public for
 users, and that's wonderful. However, we have not always properly declared
 the properties that we set in the {{{__construct()}}} methods or elsewhere
 in the class. We should work to change that fact.

 Example from BP_Groups_Group:

 {{{
 /**
  * ID of the group.
  *
  * @since 1.6.0
  * @var int
  */
 public $id;
 }}}

 {{{
 public function __construct( $id = null, $args = array() ) {
         $this->args = wp_parse_args( $args, array(
                 'populate_extras' => false,
         ) );

         if ( !empty( $id ) ) {
                 $this->id = $id;
                 $this->populate();
         }
 }
 }}}

--

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7018#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list