[wp-trac] [WordPress Trac] #54323: Too few arguments for function (closure)
WordPress Trac
noreply at wordpress.org
Wed Oct 27 21:00:08 UTC 2021
#54323: Too few arguments for function (closure)
-------------------------------------------------+-------------------------
Reporter: aristath | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.8.2
Component: Script Loader | Version:
Severity: major | Resolution:
Keywords: has-patch needs-unit-tests fixed- | Focuses: coding-
major | standards
-------------------------------------------------+-------------------------
Comment (by jrf):
Thanks @SergeyBiryukov for providing the historical context!
> However, it was deemed acceptable because in this scenario, the
anonymous function enqueues a stylesheet and doesn't do anything else...
While the above is true, I still think it should be changed as it may give
new(er) contributors the impression that closures as hook callbacks are
acceptable. Consistency is key in these things and having a rule like this
applied inconsistently only provides confusion and leads to repeated
discussions about it (''why is it allowed there, but not here ?'').
> It would definitely be a great idea, looks like there are no tests for
enqueue_block_styles_assets() yet. The original changesets, [46111] and
[51471], did not have any tests either.
Ouch. That's just painful. Old code not having tests I can understand,
we're playing catch-up. But greenfields new code being introduced without
tests or with insufficient tests is something I'd really like to
eradicate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54323#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list