Commit 64d4a6d
committed
Coding Standards: Use
This replaces `array_values( ... )[0]` and `array_slice( ..., 0, 1 )[0]` constructs with the `array_first()` function added in PHP 8.5 for improved readability.
WordPress core includes a polyfill for `array_first()` on PHP < 8.5 as of WordPress 6.9, so the change works on every supported PHP version without raising the minimum requirement.
Follow-up to [9685], [50995], [60672].
Props Soean, mukesh27.
See #65598.
git-svn-id: https://develop.svn.wordpress.org/trunk@62695 602fd350-edb4-49c9-b593-d223f7449a82array_first() to get the first array element.1 parent 99fc144 commit 64d4a6d
2 files changed
Lines changed: 2 additions & 3 deletions
File tree
- src/wp-includes
- rest-api/endpoints
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
| 507 | + | |
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| |||
0 commit comments