[wp-trac] [WordPress Trac] #56033: PHP 8.2: explicitly declare all known properties

WordPress Trac noreply at wordpress.org
Sun Aug 7 13:56:51 UTC 2022


#56033: PHP 8.2: explicitly declare all known properties
--------------------------------------------+-----------------------------
 Reporter:  jrf                             |       Owner:  SergeyBiryukov
     Type:  task (blessed)                  |      Status:  accepted
 Priority:  normal                          |   Milestone:  6.1
Component:  General                         |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch php82 has-unit-tests  |     Focuses:
--------------------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 In [changeset:"53850" 53850]:
 {{{
 #!CommitTicketReference repository="" revision="53850"
 Code Modernization: Remove dynamic properties in `Tests_POMO_PO`.

 In this particular case, the test class contains a `set_up()` method which
 sets properties only used by select tests, while the fixture method is
 being run for all tests.

 There were a few ways this could be fixed:
 * As the values do not change across tests, use `set_up_before_class()` to
 set (static) properties instead.
 * For those values which are set up without a function call or variable
 interpolation, set the values in class constants.
 * Or set these values as local variables for those tests which actually
 use them.

 The implemented solution is a combination of options 2 and 3.

 Follow-up to [1106/tests], [53557], [53558].

 Props jrf.
 See #56033.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56033#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list