Commit 260fcbe
committed
Code Modernization: Use
This commit replaces a `foreach` loop in `::check_post_type_supports_notes()` that iterates the editor supports, returns `true` as soon as an element has non-empty notes, and otherwise falls through to `false`. That is exactly what PHP 8.4's `array_any()` expresses in a single, more readable call.
WordPress core includes a polyfill for `array_any()` on PHP < 8.4 as of WordPress 6.8, so the change works on every supported PHP version without raising the minimum requirement.
Follow-up to [59783], [62550], [62553].
Props Soean.
See #65519.
git-svn-id: https://develop.svn.wordpress.org/trunk@62564 602fd350-edb4-49c9-b593-d223f7449a82array_any() in WP_REST_Comments_Controller.1 parent 5908f03 commit 260fcbe
1 file changed
Lines changed: 4 additions & 6 deletions
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2049 | 2049 | | |
2050 | 2050 | | |
2051 | 2051 | | |
| 2052 | + | |
2052 | 2053 | | |
2053 | 2054 | | |
2054 | 2055 | | |
| 2056 | + | |
2055 | 2057 | | |
2056 | 2058 | | |
2057 | 2059 | | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
2063 | | - | |
| 2060 | + | |
| 2061 | + | |
2064 | 2062 | | |
2065 | 2063 | | |
0 commit comments