[wp-trac] [WordPress Trac] #51423: Fix function argument type issues reported by PHPStan

WordPress Trac noreply at wordpress.org
Mon Mar 29 18:13:58 UTC 2021


#51423: Fix function argument type issues reported by PHPStan
-------------------------------------------------+-------------------------
 Reporter:  SergeyBiryukov                       |       Owner:
                                                 |  hellofromTonya
     Type:  task (blessed)                       |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.8
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php8 has-patch has-unit-tests        |     Focuses:  coding-
  commit                                         |  standards
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  php8 has-patch => php8 has-patch has-unit-tests commit


Comment:

 @SergeyBiryukov [https://github.com/WordPress/wordpress-develop/pull/758
 PR 758] is for ready for commit. @jrf and I have reviewed and tested it.
 She's approved it.

 tl;dr
 - Function: `wp_privacy_generate_personal_data_export_file()`
 - Problem: When/if the `'_export_data_grouped'` post meta exists but is
 not an array, a PHP Warning (< 8)/Error (8+) is thrown for `array_merge`
 argument 2 type mismatch.
 - Fix: `_doing_it_wrong` and sets vars to retain current behavior
 - Also refactors tests to
     - Reduce redundant code
     - Switch to data provider
     - Test on the full HTML output instead of select pieces of the output
     - Expands unhappy path coverage

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


More information about the wp-trac mailing list