[wp-trac] [WordPress Trac] #44979: Parameter 1 to wp_default_styles() expected to be a reference, value given

WordPress Trac noreply at wordpress.org
Sat Aug 3 17:00:27 UTC 2019


#44979: Parameter 1 to wp_default_styles() expected to be a reference, value given
---------------------------+-----------------------------
 Reporter:  jqz            |       Owner:  SergeyBiryukov
     Type:  defect (bug)   |      Status:  accepted
 Priority:  normal         |   Milestone:  5.3
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+-----------------------------

Comment (by killerbishop):

 I've been working on making a patch for this issue and testing against PHP
 5.6. Changing the reference requires changing other downstream functions
 that are called by it such as `wp_default_packages()`. I noticed in the
 `wp-admin/load-scripts.php` that the functions are called outside the
 class and pass a new instance directly. Is `do_action()` really needed
 here or can it just be replaced with a direct call like
 `wp_default_scripts($this)`?

 Lastly, is there any issue with adding typehints like:

 `function wp_default_scripts( WP_Scripts $scripts )`

 I see very few uses of it grepping around, but the contributor's handbook
 makes no reference either way on this. Historically, I can see it being
 not used for compatibility with older PHP versions and perhaps is
 something being discussed still.

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


More information about the wp-trac mailing list