Commit 3fccf83
committed
Code Modernization: Use
This commit replaces several `foreach` loops that iterate an array, return `false` as soon as an element fails a condition, and otherwise fall through to `true`. That is exactly what PHP 8.4's `array_all()` expresses in a single, more readable call.
WordPress core includes a polyfill for `array_all()` 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].
Props Soean, mukesh27, westonruter, SergeyBiryukov.
See #65519.
git-svn-id: https://develop.svn.wordpress.org/trunk@62553 602fd350-edb4-49c9-b593-d223f7449a82array_all() where appropriate.1 parent 434c770 commit 3fccf83
3 files changed
Lines changed: 6 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
| 830 | + | |
837 | 831 | | |
838 | 832 | | |
839 | 833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5318 | 5318 | | |
5319 | 5319 | | |
5320 | 5320 | | |
5321 | | - | |
5322 | | - | |
5323 | | - | |
5324 | | - | |
5325 | | - | |
5326 | | - | |
5327 | | - | |
| 5321 | + | |
5328 | 5322 | | |
5329 | 5323 | | |
5330 | 5324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2095 | 2095 | | |
2096 | 2096 | | |
2097 | 2097 | | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
2105 | 2102 | | |
2106 | 2103 | | |
2107 | 2104 | | |
| |||
0 commit comments