[wp-trac] [WordPress Trac] #51553: PHP 8.0: code improvements to allow for named parameters in function calls
WordPress Trac
noreply at wordpress.org
Tue Nov 17 15:52:21 UTC 2020
#51553: PHP 8.0: code improvements to allow for named parameters in function calls
-------------------------------------------+-------------------------------
Reporter: jrf | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: 5.7
Component: General | Version:
Severity: normal | Resolution:
Keywords: php8 needs-dev-note has-patch | Focuses: coding-standards
-------------------------------------------+-------------------------------
Changes (by desrosj):
* keywords: 2nd-opinion php8 needs-dev-note has-patch => php8 needs-dev-
note has-patch
* milestone: 5.6 => 5.7
Comment:
I was reviewing the task 1 PR with the intention of landing it prior to
RC1, but I think it's best to wait in order perform a more thorough review
and have a longer testing period for any issues.
Since we are going to explicitly advise against using named parameters in
5.6, task 1 should not cause compatibility issues. Unless someone goes
against the advisory at their own risk.
I was discussing with @SergeyBiryukov, and here are some notes from what
we discussed:
- There are a few name changes that we didn't love. For example, renaming
`$item` to `$data_object` everywhere int eh affected code. It seems
simpler to just assign `$item=$data_object;` at the beginning. This is
something done in other instances already.
- In some places the PR just assignes `$post = $item` at the beginning, in
others it replaces everything with `$item`, which could make the code less
clear. One location this is noticeable is within `class-wp-ms-themes-list-
tablep.php`. The [https://github.com/WordPress/wordpress-
develop/pull/612/files#diff-
0dc5774897687f8570c4ae0af63be5074e83455f3382cca1db88ce9a05656554 first two
methods rename the variable across the whole method, but the third one
does not]. Would be great to have some consistency there.
I think task 3 is the only area here for potential issues in PHP 8 when
not utilizing the named parameters feature, but to my knowledge no related
problems have been reported. It's likely some will be uncovered going
forward though.
All this being said, let's prioritize this for 5.7 with #50531.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51553#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list